question

9sunflowercottage avatar image
0 Likes"
9sunflowercottage asked ·

post-order API - 401 Error (Access-Control-Allow-Origin)

Hello, I'm trying to use the post-order API but have some problems. I am getting a 401 error saying this: > XMLHttpRequest cannot load > https://api.ebay.com/post-order/v2/return/search?&Authorization=TOKEN+%3CAg…TPLACE-ID=EBAY_US&contentType=application%2Fjson&Accept=application%2Fjson. > No 'Access-Control-Allow-Origin' > header is present on the requested > resource. Origin > 'http://localhost:53747' is therefore > not allowed access. The response had > HTTP status code 401. It also does the same live as well as localhost. Am I missing something here, or is it not supported with ajax in the same way as other API's? Code is below. Many thanks!! var token = "xxxxxxxx"; jQuery.ajax({ url: " https://api.ebay.com/post-order/v2/return/search?";, type: "GET", data: { 'Authorization' : 'TOKEN <'+token+'>', 'X-EBAY-C-MARKETPLACE-ID': 'EBAY_UK', 'contentType': 'application/json', 'Accept': 'application/json' }, success: function (result) { console.log('success'); console.table(result); }, error: function (data) { console.log('fail'); console.table((data)); } })
apipost-order api401ajax
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shulmani_developer.support avatar image
0 Likes"
shulmani_developer.support answered ·
Hi, At the very glance looking into the request, the HEADER : Authorization has the wrong value. The value should read like: TOKEN i.e Token AA*8** It should not be TOKEN . Remove the `<` and `>`' before and after the token value. Hope this should resolve your issue. Cheers!!!
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shulmani_developer.support avatar image
0 Likes"
shulmani_developer.support answered ·
Hi, At the very glance looking into the request, the HEADER : Authorization has the wrong value. The value should read like: TOKEN i.e Token AA*8****************** It should not be TOKEN . Remove the '' before and after the token value. Hope this should resolve your issue. Cheers!!!
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jeffregrizzl-0 avatar image
0 Likes"
jeffregrizzl-0 answered ·
any luck with this? having same issue
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.