Platform Images wrong Response Error

Projects, Applications, and API development.
Post Reply
maltenf
Posts: 4
Joined: Fri Mar 05, 2021 2:11 am

Platform Images wrong Response Error

Post by maltenf »

Hi!
Since yesterday get any empty response for all IDs at endpoing /Platforms/Images.

Also the empty response seems to be wrong. Cause when filled the property is an Object but in empty responses its an array which cause in strongly type programming languages problems / errors:
Example of C# returned by my current library:

Code: Select all

Error in rest call: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary`2[System.Int32,TheGamesDBApiWrapper.Models.Entities.PlatformImageModel[]]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path 'data.images', line 1, position 446. with response raw data ""

Example Request:

Code: Select all

https://api.thegamesdb.net/v1/Platforms/Images?apikey=<key>&platforms_id=1583%2C1584%2C1585%2C1586%2C1587%2C1588%2C1589%2C1590%2C1591%2C1592%2C1593%2C1594%2C1595%2C1596%2C1597%2C1598%2C1599%2C1600%2C1601%2C1602%2C1603%2C1604%2C1605%2C1606%2C1607%2C1608%2C1609%2C1610%2C1611%2C1612%2C1613%2C1614%2C1615%2C1616%2C1617%2C1618%2C1619%2C1620%2C1621%2C1622%2C1623%2C1624%2C1625%2C1626%2C1627%2C1628%2C1629%2C1630%2C1631%2C1632%2C1633%2C1634%2C1635%2C1636%2C1637%2C1638%2C1639%2C1640%2C1641%2C1642%2C1643%2C1644%2C1645%2C1646%2C1647%2C1648%2C1649%2C1650%2C1651%2C1652%2C1653%2C1654%2C1655%2C1656%2C1657%2C1658%2C1659%2C1660%2C1661%2C1662%2C1663%2C1664%2C1665%2C1666%2C1667%2C1668%2C1669%2C1670%2C1671%2C1672%2C1673%2C1674%2C1675%2C1676%2C1677%2C1678%2C1679%2C1680%2C1681%2C1682%2C1683%2C1684%2C1685%2C1686%2C1687%2C1688%2C1689%2C1690%2C1691%2C1692%2C1693%2C1694%2C1695%2C2696%2C2697%2C2698%2C2699%2C2700%2C2701%2C270
Is there something wrong? Last week I got a full response with this request.

For empty responses it whould be better to return an empty object instead of an empty array :-)

User avatar
edirol
Posts: 745
Joined: Thu Jun 28, 2018 1:08 am

Re: Platform Images wrong Response Error

Post by edirol »

You get empty response because the platform ids you reqest do not exist. Get proper ids via /v1/Platforms endpoint first.

maltenf
Posts: 4
Joined: Fri Mar 05, 2021 2:11 am

Re: Platform Images wrong Response Error

Post by maltenf »

Im so sorry!
In refactoring i mixed up my DB Ids with TheGamesDB Ids... Worked too long on the cronjob. I think you can delete this :-) Sorry again.

User avatar
edirol
Posts: 745
Joined: Thu Jun 28, 2018 1:08 am

Re: Platform Images wrong Response Error

Post by edirol »

No probs, it's ok.
I redirected your question about object/array to our admin.

User avatar
Zer0xFF
Posts: 330
Joined: Fri Apr 20, 2018 9:18 am

Re: Platform Images wrong Response Error

Post by Zer0xFF »

I'm glad the fix was simple,

if you run into an error like this again, please do let us know.
Regards
Zer0xFF

Post Reply