question

sing-harv avatar image
0 Likes"
sing-harv asked

UploadSiteHostedPictures is not compatible with OAuth

I am getting Access Token is invalid error when using OAuth token to run UploadSiteHostedPicturesRequest defaulting back to Auth n Auth works fine for this Trading API request. OAuth however works fine for all other calls I am doing so far.

oauthuploadsitehostedpicturesuploadsitehostedpicturesrequestauth token is invalidauth n auth and oauth
10 |600

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

jitendra_developersupport avatar image
0 Likes"
jitendra_developersupport answered

Hi @sing-harv,


To make a Trading API request using OAuth, please follow the steps mentioned below:


  1. Remove the <RequesterCredentials> field and its associated value from the request payload (this field is used to pass your Auth'n'Auth credentials).
  2. Add the X-EBAY-API-IAF-TOKEN HTTP request header to the request and populate its value with a valid User access token.


Here's an example of the HTTP request headers and the associated payload needed for a UploadSiteHostedPictures request:

HTTP Headers
    X-EBAY-API-IAF-TOKEN              <UserAccessTokenValue>
    X-EBAY-API-CALL-NAME              UploadSiteHostedPictures
    X-EBAY-API-SITEID                 0
    X-EBAY-API-COMPATIBILITY-LEVEL    1085

Request Payload 
<?xml version="1.0" encoding="utf-8"?>
<UploadSiteHostedPicturesRequest xmlns="urn:ebay:apis:eBLBaseComponents">    
<ErrorLanguage>en_US</ErrorLanguage>
<WarningLevel>High</WarningLevel>
  <ExternalPictureURL>https://developer.ebay.com/cms/img/home/home-hero-web.jpg</ExternalPictureURL>
  <PictureName>Developer Page Banner</PictureName>
</UploadSiteHostedPicturesRequest>


Best Regards,

eBay Developer Support


10 |600

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

sing-harv avatar image
0 Likes"
sing-harv answered

I have tried the above. option by moving the OAuth token to header instead of the request XML but got the below error exception from eBay:

<?xml version="1.0" encoding="UTF-8"?>
<UploadSiteHostedPicturesResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2022-06-21T11:21:28.512Z</Timestamp><Ack>Failure</Ack><Errors><ShortMessage>Sorry, something went wrong. Please wait a moment and try again.</ShortMessage><LongMessage>Sorry, something went wrong. Please wait a moment and try again.</LongMessage><ErrorCode>10007</ErrorCode><SeverityCode>Error</SeverityCode><ErrorParameters ParamID="0"><Value>Web Service framework internal error.</Value></ErrorParameters><ErrorClassification>RequestError</ErrorClassification></Errors><Version>1201</Version><Build>E1201_CORE_API6_19110890_R1</Build></UploadSiteHostedPicturesResponse>
21-06-2022 12:21:29 - <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<UploadSiteHostedPicturesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
    <Timestamp>2022-06-21T11:21:28.935Z</Timestamp>
    <Ack>Failure</Ack>
    <Errors>
        <ShortMessage>No Password and no token.</ShortMessage>
        <LongMessage>No XML &amp;lt;RequestPassword&amp;gt; or &amp;lt;RequestToken&amp;gt; was found in XML Request.</LongMessage>
        <ErrorCode>930</ErrorCode>
        <SeverityCode>Error</SeverityCode>
        <ErrorParameters ParamID="0"/>
        <ErrorClassification>RequestError</ErrorClassification>
    </Errors>
    <Version>0</Version>
    <Build>mediasvcs-5.0.20_20220615175658903</Build>
    <PictureSystemVersion>2</PictureSystemVersion>
</UploadSiteHostedPicturesResponse>

Previously I have not been adding Auth token to Trading API request headers at all, however after upgrading to OAuth all my Trading API calls are working as is except for the UploadSiteHostedPictures.

· 3
10 |600

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

because u are working with php, maybe this helps, u just have to replace the eBayAuthToken with the header as developer support explained:

https://packagist.org/packages/macropage-sdk/ebay-trading-upload-images

1 Like 1 ·

Thanks, funny enough I tried to do exactly as mentioned by Support above but it failed with the above exception. Just now after your comment I tried again but this time not removing <RequesterCredentials> from the request XML and it has worked.

Thanks

0 Likes 0 ·
okay, good 2 know... i only work with auth'n'auth because when not really needed, this whole oauth stuff is a useless overhead..... ;)
0 Likes 0 ·
sing-harv avatar image
1 Like"
sing-harv answered

To update this thread for everyone:

Failure: when <RequesterCredentials> from request XML and adding X-EBAY-API-IAF-TOKEN in header

Success: Keeping <RequesterCredentials> in request XML and adding X-EBAY-API-IAF-TOKEN in header


Thank you @jitendra_developersupport and @michab2003

10 |600

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.