Reputation: 2415
I'm trying to connect to the Adobe Analytics found here
I've managed to generate an auth token using the below request:
curl -i -v "https://api.omniture.com/token" -u 'my-user' -d "grant_type=client_credentials"
I then copy the whole object thats returned which looks something like this:
{
"access_token": "some-really-long-access-token",
"expires_in": 3600,
"token_type": "bearer",
"scope": "livestream",
"success": true
}
and paste it into the following cURL:
curl --location --compressed --header “Authorization: Bearer [{"access_token":"some-really-long-access-token","expires_in":3600,"token_type":"bearer","scope":"livestream","success":true}]” [https://livestream.adobe.net/api/1/stream/myendpoint]
The error i'm getting is:
Couldn't resolve host 'Bearer'
I'm fairly new to cURL so not sure if there is an obvious error here? Will most likely be down to the way i'm sending the data over...
EDIT
After the answer written below this is the error message i'm getting:
curl: (6) Couldn't resolve host 'Bearer'
curl: (6) Couldn't resolve host 'some-really-long-auth-key
invalid authorization header
Upvotes: 5
Views: 13164
Reputation: 6200
Okay, the part you need to pass in the header is the "some-really-long-access-token"
Example:
curl --compressed --header "Authorization: Bearer some-really-long-access-token" "https://livestream.adobe.net/api/1/stream/myendpoint"
So just pay attention to the encoding on the "
.
“
is not the same as "
Edit:
Your question is tagged php
, but your examples are using the command line, therefore, ensure your command is formatted using the following points:
A header is passed like this: -H "Header-name: Header-Value"
29035-97v657zyr8qk966y143k2v0p365460xbd1pvk9p6
Then my header arguments would be this:
-H "Authorization: Bearer 29035-97v657zyr8qk966y143k2v0p365460xbd1pvk9p6"
You can explicitly specify the url to cURL
using --url
. I don't usually do this because it shouldn't be necessary if everything is correct, but it may help refine the error message.
--url "https://livestream.adobe.net/api/1/stream/myendpoint"
Be sure as described above NOT to use LEFT AND RIGHT DOUBLE QUOTATION MARK “
and ”
, but the standard "
found on the computer keyboard. The standard "
is what the shell uses to contain arguments
Upvotes: 12