# getItem
# eBay Golang example: getItem API
The getItem call obtains information on a listing using its item number.
Minimum Golang example showing how to get full information on an item for sale.
# eBay documentation notes
getItem boasts a huge number of options. This version of the call can result in an enormous payload with information on all pictures, full title and description, and so on.
# file: main.go
// Get information about an item on eBay.
// Display it (or error returned)
// Obviously the token assigned to the variable
// named token has to be replaced and a current item number
// must be specified
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
// Real item IDs
// 352638628201
// 183776213332
func main() {
// Replace with current item number.
itemNumber := "352638628201"
// Build up the GET request.
req, err := http.NewRequest("GET",
"https://api.ebay.com/buy/browse/v1/item/v1|"+
itemNumber+
"|0?fieldgroups=PRODUCT",
nil)
// Replace with a much longer token
// obtained with in the last two
// hours.
token :=
"v^1.1#...AAA=="
// The Authorization header is followed by
// the string 'Bearer ' followed by a base64-
// encoded token obtained recently.
req.Header.Add("Authorization", "Bearer "+token)
client := &http.Client{}
// Execute the GET request.
// Return with JSON payload in resp.Body
resp, err := client.Do(req)
defer resp.Body.Close()
if err != nil {
fmt.Printf("GET request failed with error %s\n", err)
} else {
// Item information was available.
// More information than you could
// possibly want has been returned
// in resp.Body.
data, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(data))
}
}
# Results of a successful run
Should everything go as planned the program output for an existing item would look like this:
{"itemId":"v1|352638628201|0","title":"Fender - Squire Strat ELECTRIC GUITAR ( LOT 9934) ","shortDescription":"Unit is used, and It has been tested to work fine.","price":{"value":"177.50","currency":"USD"},"categoryPath":"Musical Instruments & Gear|Guitars & Basses|Electric Guitars","condition":"Used","conditionId":"3000","itemLocation":{"city":"Albertville","stateOrProvince":"Alabama","postalCode":"35950","country":"US"},"image":{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/akYAAOSwVVlcrLrX/$_57.JPG?set_id=8800005007"},"additionalImages":[{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/PdsAAOSw3GFcrLra/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/ygcAAOSwQVVcrLrd/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/T4IAAOSwftNcrLrg/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/70kAAOSw17hcrLrj/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/h40AAOSwRxpcrLrm/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/Mu4AAOSwO09crLrq/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/-vQAAOSwnO5crLrs/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/7doAAOSw44FcrLrv/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/ucYAAOSwJrdcrLry/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/PpMAAOSwAzVcrLr0/$_57.JPG?set_id=8800005007"},{"imageUrl":"https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/400AAOSwJZRcrLr3/$_57.JPG?set_id=8800005007"}],"currentBidPrice":{"value":"177.50","currency":"USD"},"brand":"Fender","itemEndDate":"2019-04-16T15:32:18.000Z","seller":{"username":"joespawn1243","feedbackPercentage":"99.5","feedbackScore":110980},"estimatedAvailabilities":[{"deliveryOptions":["SHIP_TO_HOME"],"estimatedAvailabilityStatus":"OUT_OF_STOCK","estimatedAvailableQuantity":0,"estimatedSoldQuantity":1}],"shippingOptions":[{"shippingServiceCode":"UPS Ground","shippingCarrierCode":"UPS","type":"Standard Shipping","shippingCost":{"value":"19.99","currency":"USD"},"quantityUsedForEstimate":1,"minEstimatedDeliveryDate":"2019-04-18T10:00:00.000Z","maxEstimatedDeliveryDate":"2019-04-25T10:00:00.000Z","additionalShippingCostPerUnit":{"value":"0.00","currency":"USD"},"shippingCostType":"FIXED"}],"shipToLocations":{"regionIncluded":[{"regionName":"United States","regionType":"COUNTRY"}]},"returnTerms":{"returnsAccepted":true,"refundMethod":"MONEY_BACK","returnShippingCostPayer":"SELLER","returnPeriod":{"value":30,"unit":"CALENDAR_DAY"}},"taxes":[{"taxJurisdiction":{"region":{"regionName":"Iowa","regionType":"STATE_OR_PROVINCE"},"taxJurisdictionId":"IA"},"taxType":"STATE_SALES_TAX","shippingAndHandlingTaxed":true,"includedInPrice":false,"ebayCollectAndRemitTax":true},{"taxJurisdiction":{"region":{"regionName":"Minnesota","regionType":"STATE_OR_PROVINCE"},"taxJurisdictionId":"MN"},"taxType":"STATE_SALES_TAX","shippingAndHandlingTaxed":true,"includedInPrice":false,"ebayCollectAndRemitTax":true},{"taxJurisdiction":{"region":{"regionName":"Washington","regionType":"STATE_OR_PROVINCE"},"taxJurisdictionId":"WA"},"taxType":"STATE_SALES_TAX","shippingAndHandlingTaxed":true,"includedInPrice":false,"ebayCollectAndRemitTax":true}],"localizedAspects":[{"type":"STRING","name":"Brand","value":"Fender"}],"primaryProductReviewRating":{"reviewCount":0,"averageRating":"0.0","ratingHistograms":[{"rating":"5","count":0},{"rating":"4","count":0},{"rating":"3","count":0},{"rating":"2","count":0},{"rating":"1","count":0}]},"topRatedBuyingExperience":true,"buyingOptions":["AUCTION"],"bidCount":62,"itemWebUrl":"https://www.ebay.com/itm/Fender-Squire-Strat-ELECTRIC-GUITAR-LOT-9934-/352638628201","description":"<font rwr='1' size='4' style='font-family:Arial'>This listing is for 1 GUITAR as shown/listed. Unit is used, and It has been tested to work fine. Comes as shown. <br></font>","minimumPriceToBid":{"value":"180.00","currency":"USD"},"uniqueBidderCount":7,"enabledForGuestCheckout":false,"adultOnly":false,"categoryId":"33034"}
When formatted properly the output would look something like this, courtesy the online JSON viewer at http://jsonviewer.stack.hu/:
{
"itemId": "v1|352638628201|0",
"title": "Fender - Squire Strat ELECTRIC GUITAR ( LOT 9934) ",
"shortDescription": "Unit is used, and It has been tested to work fine.",
"price": {
"value": "177.50",
"currency": "USD"
},
"categoryPath": "Musical Instruments & Gear|Guitars & Basses|Electric Guitars",
"condition": "Used",
"conditionId": "3000",
"itemLocation": {
"city": "Albertville",
"stateOrProvince": "Alabama",
"postalCode": "35950",
"country": "US"
},
"image": {
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/akYAAOSwVVlcrLrX/$_57.JPG?set_id=8800005007"
},
"additionalImages": [
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/PdsAAOSw3GFcrLra/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/ygcAAOSwQVVcrLrd/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/T4IAAOSwftNcrLrg/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/70kAAOSw17hcrLrj/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/h40AAOSwRxpcrLrm/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/Mu4AAOSwO09crLrq/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/-vQAAOSwnO5crLrs/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/7doAAOSw44FcrLrv/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/ucYAAOSwJrdcrLry/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/PpMAAOSwAzVcrLr0/$_57.JPG?set_id=8800005007"
},
{
"imageUrl": "https://i.ebayimg.com/00/s/MTIwMFgxNjAw/z/400AAOSwJZRcrLr3/$_57.JPG?set_id=8800005007"
}
],
"currentBidPrice": {
"value": "177.50",
"currency": "USD"
},
"brand": "Fender",
"itemEndDate": "2019-04-16T15:32:18.000Z",
"seller": {
"username": "joespawn1243",
"feedbackPercentage": "99.5",
"feedbackScore": 110980
},
"estimatedAvailabilities": [
{
"deliveryOptions": [
"SHIP_TO_HOME"
],
"estimatedAvailabilityStatus": "OUT_OF_STOCK",
"estimatedAvailableQuantity": 0,
"estimatedSoldQuantity": 1
}
],
"shippingOptions": [
{
"shippingServiceCode": "UPS Ground",
"shippingCarrierCode": "UPS",
"type": "Standard Shipping",
"shippingCost": {
"value": "19.99",
"currency": "USD"
},
"quantityUsedForEstimate": 1,
"minEstimatedDeliveryDate": "2019-04-18T10:00:00.000Z",
"maxEstimatedDeliveryDate": "2019-04-25T10:00:00.000Z",
"additionalShippingCostPerUnit": {
"value": "0.00",
"currency": "USD"
},
"shippingCostType": "FIXED"
}
],
"shipToLocations": {
"regionIncluded": [
{
"regionName": "United States",
"regionType": "COUNTRY"
}
]
},
"returnTerms": {
"returnsAccepted": true,
"refundMethod": "MONEY_BACK",
"returnShippingCostPayer": "SELLER",
"returnPeriod": {
"value": 30,
"unit": "CALENDAR_DAY"
}
},
"taxes": [
{
"taxJurisdiction": {
"region": {
"regionName": "Iowa",
"regionType": "STATE_OR_PROVINCE"
},
"taxJurisdictionId": "IA"
},
"taxType": "STATE_SALES_TAX",
"shippingAndHandlingTaxed": true,
"includedInPrice": false,
"ebayCollectAndRemitTax": true
},
{
"taxJurisdiction": {
"region": {
"regionName": "Minnesota",
"regionType": "STATE_OR_PROVINCE"
},
"taxJurisdictionId": "MN"
},
"taxType": "STATE_SALES_TAX",
"shippingAndHandlingTaxed": true,
"includedInPrice": false,
"ebayCollectAndRemitTax": true
},
{
"taxJurisdiction": {
"region": {
"regionName": "Washington",
"regionType": "STATE_OR_PROVINCE"
},
"taxJurisdictionId": "WA"
},
"taxType": "STATE_SALES_TAX",
"shippingAndHandlingTaxed": true,
"includedInPrice": false,
"ebayCollectAndRemitTax": true
}
],
"localizedAspects": [
{
"type": "STRING",
"name": "Brand",
"value": "Fender"
}
],
"primaryProductReviewRating": {
"reviewCount": 0,
"averageRating": "0.0",
"ratingHistograms": [
{
"rating": "5",
"count": 0
},
{
"rating": "4",
"count": 0
},
{
"rating": "3",
"count": 0
},
{
"rating": "2",
"count": 0
},
{
"rating": "1",
"count": 0
}
]
},
"topRatedBuyingExperience": true,
"buyingOptions": [
"AUCTION"
],
"bidCount": 62,
"itemWebUrl": "https://www.ebay.com/itm/Fender-Squire-Strat-ELECTRIC-GUITAR-LOT-9934-/352638628201",
"description": "<font rwr='1' size='4' style='font-family:Arial'>This listing is for 1 GUITAR as shown/listed. Unit is used, and It has been tested to work fine. Comes as shown. <br></font>",
"minimumPriceToBid": {
"value": "180.00",
"currency": "USD"
},
"uniqueBidderCount": 7,
"enabledForGuestCheckout": false,
"adultOnly": false,
"categoryId": "33034"
}