0

(I am new to curl and also apigee)

I am trying to get the Body data from API

"https://staging.api.pearson.com/content/scapi/urn:pearson:manifestation:014f333d-ceda-476f-81f2-d3d6c89ace42"

using curl with following command but unable to get any data than fault string

curl "https://staging.api.pearson.com/content/scapi/urn:pearson:manifestation:014f333d-ceda-476f-81f2-d3d6c89ace42"

Error that I am getting is :

{"fault":{"faultstring":"Failed to resolve API Key variable request.header.x-api key","detail":"errorcode":"steps.oauth.v2.FailedToResolveAPIKey"}}}

but when accessing the URL multiple times in Browser, I can able to get JSON data as desired

enter image description here

CURL woking code

curl "https://staging.api.pearson.com/content/scapi/urn:pearson:manifestation:014f333d-ceda-476f-81f2-d3d6c89ace42" -H "Accept:application/json"  -H "Accept-Encoding:gzip, deflate, sdch, br" -H "Accept-Language:en-US,en;q=0.8 " -H "Connection:keep-alive" -H "Host:staging.api.pearson.com" -H "X-ApiKey:7ij8zrLkCNR9DtAXx3KJ6yutoYnk4SAx" -H "X-PearsonSSOSession:AQIC5wM2LY4Sfczr6fmuhzvfN4dwnpK3c9K8tyduHkwg7sA.*AAJTSQACMDIAAlNLABQtNTk5Nzg3OTI1MTgxNTYxNjE3MAACUzEAAjAx*"

Kindly somebody suggest to get JSON data

Sorry I am new to curl and also apigee

Thanks

Bugs
  • 4,491
  • 9
  • 32
  • 41
  • https://staging.api.pearson.com/content/scapi/urn:pearson:manifestation:014f333d-ceda-476f-81f2-d3d6c89ace42 does not work at browser too. https://screencast.com/t/vHK3UuKNu – Afzal Masood Jun 08 '17 at 12:42
  • but I don't know how my chrome got that, anyway could you please go back and forth on the browser by modifying url, then you will get data automatically – Elambarathi Vimal Kannan Jun 08 '17 at 12:45
  • Please do not vandalize your posts. Once you've posted a question, you have licensed the content to the Stack Overflow community at large (under the CC-by-SA license). If you would like to disassociate this post from your account, see [What is the proper route for a disassociation request?](http://meta.stackoverflow.com/questions/323395/what-is-the-proper-route-for-a-dissociation-request). – Bugs Jun 30 '17 at 13:50

2 Answers2

2

enter image description here

As you said that in the chrome, it is working, on the successful request, you can copy as curl like below

Ravikiran Reddy Kotapati
  • 2,485
  • 3
  • 22
  • 27
0
curl "URL" \
 -H "Accept: application/json" \
 -H "x-apikey: {need to pass your API key here}" \
 -H "Content-Type: application/octet-stream"

Put your x-apikey in {need to pass your API key here}

Ravikiran Reddy Kotapati
  • 2,485
  • 3
  • 22
  • 27