11-05-2024 04:45 AM
I am trying to create a new documentid using createDocument API from Media RESTful API so that I can upload the document later, for this documentid. I am doing this in my Production account. But every time, I am getting the error "HTTP Status 500 – Internal Server Error".
This doesn't work at all in the sandbox environment. It always says "Error 404: Not Found
Resource not found (A resource (URI) associated with the request could not be resolved.)"
I really need to get this work for GPSR deadline which is 21st December 2024
11-08-2024 01:45 AM - edited 11-08-2024 01:46 AM
Hi @mtecheby,
We are able to execute the Media API documents calls without any issue and are able to upload the document as well. See Managing documents for information on creating, uploading, and adding documents to listings.
For the reference you can find the cURL code snipped for the calls below:
createDocument:
curl --location 'https://api.ebay.com/commerce/media/v1_beta/document' \
--header 'Authorization: Bearer v^1.1#i^1#p^3#r^0#f^0#' \
--header 'Content-Type: application/json' \
--data '{
"languages": [
"FRENCH",
"ENGLISH"
],
"documentType": "USER_GUIDE_OR_MANUAL"
}'
uploadDocument:
curl --location 'https://api.ebay.com/commerce/media/v1_beta/document/document_id/upload'\
--header 'Authorization: Bearer v^1.1#i^1#p^3#r^0#f^0#' \
--header 'Content-Type: multipart/form-data' \
--form 'file=@"/C:/Users/.../drone_user_warranty.pdf"'
You can also use the eBay API Explorer to test the calls.
11-08-2024 05:48 AM
Thank you for your reply
I am doing exactly the same on my production account and I am doing 'createDocument' API at the moment but I am getting "HTTP Status 500 – Internal Server Error". What could be the reason? Is there any other factor I need to consider?
FYI - My Ebay API explorer is returning the same error in my production server. Please find the attached images for your reference
I have gone through the document link many times but didn't find anything else. I am stuck at 'createDocument' so am not able to move ahead for 'uploadDocument'
Following is the response I am getting in http response:
<!doctype html><html lang=""en""><head><title>HTTP Status 500 – Internal Server Error</title><style type=""text/css"">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1></body></html>
11-13-2024 10:37 PM
I have finally managed to make this work. The issue was with the Access Token value which was fetched was incorrectly. The documentation says that while fetching the access token the content-type should be passed as "application/x-www-form-urlencoded" but for me the "UTF-8" was also required. Without UTF-8 some of the characters were missing from the access token and hence the REST api's were not working.
11-19-2024 07:58 AM
Hello mtecheby,
I have similar problems while requesting the media API. Which scope did you use when requesting the token?
12-02-2024 03:21 AM
Hi @mt-tuning,
Media API calls require an access token created with the authorization code grant flow, using the "https://api.ebay.com/oauth/api_scope/sell.inventory" scope.
12-02-2024 03:44 AM
Thx for your reply. I got it working now, was using the wrong auth flow. It's confusing sometimes.