I am just getting started on working with an API by a company called SellerVantage. But, I have not done this before and don’t understand the documentation. I have been given a token by the company. The documentation only says this about the token.
You are identified by the authorization token you are given by
SellerVantage. All requests to the Items API must include it in the
headers:
X-Authorization: TOKEN TOKEN
Where TOKEN is the token. The bareword “TOKEN” shown in the previous line must be included.
From a code perpective, I don’t really know what this means. Is this a meta tag? A hidden form field? The API returns all answers in JSON so I think I can use any language to send the requests in. The documentation is only a few paragraphs so I think this should be easy. If you want to see it, it can be found here:
But that is all kinds of wrong if for no other reason is has spaces in it.
I feel like I am missing something really basic here and I need someone to explain it to me like I am a child. As in, what would the URL look like that would work (using 123 as the token).
I highly recommend checking out postman. One very cool feature is post man can generate code in a variety of languages including basic, php curl requests.
OK, thank you all who have responded. I think I’m still a little behind in terms of some assumptions on what I know. Oddz said that the app he recommended could do “basic, php curl requests”. So I went and looked up curl. In reading around, I think curl is what I am looking for. So I ended up with this:
When I echo out $result I get nothing. I also get nothing if I comment out the line with json_decode. I don’t get an error but I thought I would at least see the JSON response.
Felgall, this looks a little different than what you suggested. So, I removed all the lines that had anything to do with the header (the array and the curl_setopt line), swapped in the line you provided and tried again. That looked like this: