question

nbgslv92 avatar image
0 Likes"
nbgslv92 asked ·

Accessing ebay api via google apps script

Hey there, I'm trying to download alerts from my seller account to a google drive spreadsheet, using the built in google apps script. First, I'm trying to authorize and get a token, I tried to send a getSessionID request with xml and succeeded. There I get stuck: How can I redirect myself after the authorization stage in ebay, to my own spreadsheet and then activate a fetchtoken request? Or should I use OAuth with google apps script and is it the only way for getiing a token from ebay api via google apps script? The code: function myFunction() { var xml = ' \ \ ' + runame + ' \ '; var headers = { 'Content-Type': 'text/xml', 'X-EBAY-API-DEV-NAME': Dev-Name, 'X-EBAY-API-APP-NAME': App-Name, 'X-EBAY-API-CERT-NAME': Cert-Name, 'X-EBAY-API-COMPATIBILITY-LEVEL': '949', 'X-EBAY-API-CALL-NAME': 'GetSessionID', 'X-EBAY-API-SITEID': '0' }; var options = { method: 'POST', headers: headers, payload: xml }; var uploadResponse = UrlFetchApp.fetch(site, options); Logger.log(uploadResponse); var document = XmlService.parse(uploadResponse); var root=document.getRootElement(); var NS=XmlService.getNamespace("urn:ebay:apis:eBLBaseComponents"); var sessionID=root.getChildText('SessionID', NS); var html=HtmlService.createHtmlOutput(' Click to Enter'); SpreadsheetApp.getUi().showSidebar(html); } function fetchtoken(sessid){ var xml=' \ \ ' + sessid + ' \ '; var headers = { 'X-EBAY-API-DEV-NAME': Dev-Name, 'X-EBAY-API-APP-NAME': App-Name, 'X-EBAY-API-CERT-NAME': Cert-Name, 'X-EBAY-API-COMPATIBILITY-LEVEL': '949', 'X-EBAY-API-CALL-NAME': 'FetchToken', 'X-EBAY-API-SITEID': '0' }; var options = { method: 'POST', headers: headers, payload: xml }; var uploadResponse = UrlFetchApp.fetch(site, options); Logger.log(uploadResponse.getContentText()); } Thank you for any help
apitokengetsessionidgoogle apps scriptdrivespreadsheet
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.

1 Answer

· Write an Answer
imc_drives avatar image
0 Likes"
imc_drives answered ·
Hi have you solved that problem? with friendly regards Andreas
· 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.