question

$$anonymous$$ avatar image
0 Likes"
$$anonymous$$ asked ·

Can't obtain a json response in ruby

Hello, I'm trying to call GetSingleItem from a ruby script using json request/response, but I can't get it to work. This is my post header (used in Net::HTTP request_post):

header = {

"X-EBAY-API-CALL-NAME" => parOperation,
"X-EBAY-API-RESPONSE-ENCODING" => "JSON",
"X-EBAY-API-APP-ID" => parAppID,
"X-EBAY-API-SITE-ID" => SiteID[@country].numericCode.to_s,
"X-EBAY-API-VERSION" => parVersion,
"X-EBAY-API-REQUEST-ENCODING" => "JSON"

}

where parOperation = "GetSingleItem", site ID is 0 and parVersion is 797. The appID is correct as it works fine for the finding api requests.

This is my json request (I've tried several other combinations as well):

{
"jsonns.xsi": "http://www.w3.org/2001/XMLSchema-instance",
"jsonns.xs": "http://www.w3.org/2001/XMLSchema",
"tns.GetSingleItemRequest":
{
"ItemID": "380497672653",
"IncludeSelector": "Details,ShippingCosts,Variations"
},
"jsonns": "urn:ebay:apis:eBLBaseComponents"
}

and this is the response I get:

{
"Ack": "Failure",
"Errors":
[
{
"ShortMessage": "Web Service framework internal error.",
"LongMessage": "Web Service framework internal error.",
"ErrorCode": "1.10",
"SeverityCode": "Error",
"ErrorClassification": "RequestError"
}
],
"Build": "E797_CORE_BUNDLED_15480631_R1",
"Version": "797"
}

The endpoint I use is open.api.ebay.com/shopping?callname=GetSingleItem. If I omit callname I get an empty response no matter what I type in the request. The code is the same I use for the finding api, just the data is changing, so I know it works. Can somebody help me with this problem please? There are no examples on how to make a json/post request on the docs, and the api testing tool only accepts xml requests!

jsonpostrubyshopping
· 1
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.

I've just tried the following command (just put in a valid app id):

curl -H "X-EBAY-API-CALL-NAME: GetSingleItem" -H "X-EBAY-API-RESPONSE-ENCODING: JSON" -H "X-EBAY-API-APP-ID: yourappid" -H "X-EBAY-API-SITE-ID: 0" -H "X-EBAY-API-VERSION: 797" -H "X-EBAY-API-REQUEST-ENCODING: JSON" --data '{"jsonns.xsi":" http://www.w3.org/2001/XMLSchema-instance","jsonns.xs":"http://www.w3.org/2001/XMLSchema","tns.GetSingleItemRequest":{"ItemID":"380497672653","IncludeSelector":"Details,ShippingCosts,Variations"},"jsonns":"urn:ebay:apis:eBLBaseComponents";}' open.api.ebay.com/shopping?callname=GetSingleItem

and I get the same error message (at least I know it's not my script and you can easily test it as well). If I remove the callname parameter I get an empty response.
0 Likes 0 · ·
InactiveAutoUser avatar image
0 Likes"
InactiveAutoUser answered ·
  • You can enable syntax highlighting of source code with the following tags: <c><cpp><drupal5>,<drupal6><java><javascript><php><python><ruby>. The supported tag styles are: <foo>[foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <a> <acronym> <address> <b> <big> <blockquote> <br> <caption> <center> <cite> <code> <col> <colgroup> <dd> <dir> <div> <dl> <dt> <em> <fieldset> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <label> <legend> <li> <link> <o> <ol> <option> <p> <param> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <style> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <title> <tr> <tt> <u> <ul> <v> <var>
  • Lines and paragraphs break automatically.
· 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.

InactiveAutoUser avatar image
0 Likes"
InactiveAutoUser answered ·
____
· 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.