#Stack Path API usage (api.stackpath.com) This is my attempt to use StackPath's API with PHP. I was unable to find an example when I looked so after some research, here is my attempt.
My interest was finding the download results (http status 200) for downloaded files. This is available through the Raw Logs in StackPath's API but it took some work to get there. The current version of this repository just var_dump
s the latest two log entries that registered as 200 / success statuses (not 206, partial download or any other status).
- Log in
- Create a new application
- At the command line use your system's php to call the script (
getStackPathOAuth1.php
) and add the consumer key, consumer secret, and company alias as arguments. - Hit enter / run
E.g.:
php getStackPathOAuth1.php somelongletternumbermixofcharacters anotherlongletternumbermix athirdshortermix
- StackPath API (especially under Authentication and Raw Logs)
- OAuthBible.com 1.0a Two-Legged
- OAuth.net (especially 5.1 and 9)
- The biggest part is getting the OAuth Authorization header correct.
- The alphabetical ordering of the signature base was unexpected.
- The urlencoding of the url (without attached GET variables) was unexpected.
- The url to be
curl
ed has to include the GET variables, again unexpected. - The excessive advice about request tokens and authorization distracted me from obtaining the Raw Logs via their own URL and the straight Authorization header, again unexpected:
'Authorization: OAuth oauth_consumer_key="longstringfromStackPathApp"oauth_nonce="random32characterString"etcetc'
- Unsupported RSA-SHA1 was unexpected and undocumented, used HMAC-SHA1 instead.
- Generally OAuth has many options and StackPath seems to know its own implementation well enough to think it's straight forward. I'm unexperience in OAuth and did not find it so.
- OAuth 1.0a Two-Legged is not documented well in the sense of what is shares and what is different from other implementations.