Get Notification History - returned 415 code

Hi there,

i trying to get notifications use curl:

curl -X POST https://api.storekit.itunes.apple.com/inApps/v1/notifications/history -H "Authorization: Bearer 88z9....E0N3Q" -d "startDate=1685577600&endDate=1696118400"

but Apple returned 415 HTTP code that means "Unsupported Media Type"

What i do wrong?

Thanx!

Answered by App Store Commerce Engineer in 762467022

Hello,

Make sure the body of your request is in JSON format, and include the appropriate content type header like so:

-H "Content-Type: application/json"

I also suggest using the App Store Server Library to avoid small issues like this, as it handles the finer points of calling the API for you:

https://github.com/apple/app-store-server-library-swift

https://github.com/apple/app-store-server-library-java

https://github.com/apple/app-store-server-library-node

https://github.com/apple/app-store-server-library-python

Check out this WWDC video for a great introduction to the library: https://developer.apple.com/videos/play/wwdc2023/10143/

Accepted Answer

Hello,

Make sure the body of your request is in JSON format, and include the appropriate content type header like so:

-H "Content-Type: application/json"

I also suggest using the App Store Server Library to avoid small issues like this, as it handles the finer points of calling the API for you:

https://github.com/apple/app-store-server-library-swift

https://github.com/apple/app-store-server-library-java

https://github.com/apple/app-store-server-library-node

https://github.com/apple/app-store-server-library-python

Check out this WWDC video for a great introduction to the library: https://developer.apple.com/videos/play/wwdc2023/10143/

Get Notification History - returned 415 code
 
 
Q