Skip to content

Instantly share code, notes, and snippets.

@jsmithdev
Last active April 18, 2017 23:37
Show Gist options
  • Save jsmithdev/721b95b1c21845dbb31401c23738c8ca to your computer and use it in GitHub Desktop.
Save jsmithdev/721b95b1c21845dbb31401c23738c8ca to your computer and use it in GitHub Desktop.
'use strict'
const port = process.env.PORT || 8080
const request = require('request')
//Be sure to change YOURAPPNAME
let keywordUrl = "http://svcs.ebay.com/services/search/FindingService/v1";
keywordUrl += "?OPERATION-NAME=findItemsByKeywords";
keywordUrl += "&SERVICE-VERSION=1.0.0";
keywordUrl += "&SECURITY-APPNAME=YOURAPPNAME";
keywordUrl += "&GLOBAL-ID=EBAY-US";
keywordUrl += "&RESPONSE-DATA-FORMAT=JSON";
//keywordUrl += "&callback=hurray";
keywordUrl += "&REST-PAYLOAD";
keywordUrl += "&keywords=android%20device";
keywordUrl += "&paginationInput.entriesPerPage=3";
request(keywordUrl, (e, r, b) => e ? error(e) : hurray(r, b))
function hurray(r, b){
JSON.parse(b).findItemsByKeywordsResponse[0].searchResult[0].item
.forEach(item => console.log(r.statusCode, item.title.toString()))
}
function error(e){
console.log('Error: ', e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment