I think there's been a recent change to the App Store Connect API; I claim that it's a bug.
When querying App Store Connect API endpoints that return arrays, like https://api.appstoreconnect.apple.com/v1/apps, the response includes a links property, of type PagedDocumentLinks. https://developer.apple.com/documentation/appstoreconnectapi/pageddocumentlinks
links should include a next link only if there's more data to provide, and, indeed, this is how it works for the /v1/apps endpoint.
But when querying inAppPurchasesV2, I find that starting very recently (this week?) the API always returns a next link, even if there's no more data to show.
{
data: [],
links: {
self: 'https://api.appstoreconnect.apple.com/v1/apps/1363309257/inAppPurchasesV2?cursor=APo&limit=50',
first: 'https://api.appstoreconnect.apple.com/v1/apps/1363309257/inAppPurchasesV2?limit=50',
next: 'https://api.appstoreconnect.apple.com/v1/apps/1363309257/inAppPurchasesV2?cursor=ASw'
},
meta: { paging: { total: 223, nextCursor: 'ASw', limit: 50 } }
}
If I request the next link, it will generate me another response with empty data and with a new cursor.
{
data: [],
links: {
self: 'https://api.appstoreconnect.apple.com/v1/apps/1363309257/inAppPurchasesV2?cursor=ASw&limit=50',
first: 'https://api.appstoreconnect.apple.com/v1/apps/1363309257/inAppPurchasesV2?limit=50',
next: 'https://api.appstoreconnect.apple.com/v1/apps/1363309257/inAppPurchasesV2?cursor=AV4'
},
meta: { paging: { total: 223, nextCursor: 'AV4', limit: 50 } }
}
Code I've written against this API (including my open-source library https://github.com/dfabulich/node-app-store-connect-api) assumes that if there's another links.next link, we should follow it; as a result, my code is looping infinitely, requesting empty data until eventually I have to give up.
This issue doesn't affect other endpoints, like /v1/apps, just this inAppPurchasesV2 endpoint.
Was this an intentional change? It seems to be a bug.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags:
App Store Connect API