question

bcunidev avatar image
0 Likes"
bcunidev asked

Deal API - getDealItems - HTTP Status 500 – Internal Server Error

Hi,

A while back I was granted access to the Deal API, and have been able to execute requests through the API explorer.

However, on my local machine I keep receiving an "HTTP Status 500 – Internal Server Error." I can get a token just fine and access other APIs such as the Browse API Search or GetItem Request, but not the Deal API.

My curl request looks like the following, once I receive the access token (I've blocked out the affiliate campaign and zip code with ****):


// Create curl resource 
$curl_deal = curl_init();

curl_setopt_array($curl_deal, array(
CURLOPT_URL => "https://api.ebay.com/buy/deal/v1/deal_item?category_ids=111422",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer " . $access_token,
"X-EBAY-C-ENDUSERCTX: affiliateCampaignId=****,
contextualLocation=country%3DUS%2Czip%3D****"
),
));

$response_deal = curl_exec($curl_deal);
$err_deal = curl_error($curl_deal);

curl_close($curl_deal);

if ($err_deal) {
echo "cURL Error #:" . $err_deal;
} else {
echo $response_deal;
}

$json_deal = json_decode($response_deal, true);


Once again, this works with other APIs. Any ideas?

Thanks for your help!

David

500 server errordeal api
10 |600

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

1 Answer

·
bcunidev avatar image
0 Likes"
bcunidev answered

Got it!

Just needed to add "X-EBAY-C-MARKETPLACE-ID: EBAY_US" to the HTTP Header request, as the eBay Marketplace ID is required for the Deal API.

I placed it right before the "X-EBAY-C-ENDUSERCTX:" affiliate header in the request above.

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.