Open topic with navigation
Examples
The Examples section provides end-to-end code samples for various common tasks. Each task may have code samples in multiple languages. Each sample provides a description of the tasks being performed, the prerequisites (if any), and the methods that are used. Methods can be viewed in the Methods book.
The most common tasks performed on the Photobucket site are:
Values for Examples
The following values are used in all examples:
- Consumer Key <consumer_key>: 1020304
- Consumer Secret <consumer_secret>: 9eb84090956c484e32cb6c08455a667b
- OAuth Version <oauth_version>: 1.0
- OAuth Signature Method <oauth_signature_method>: HMAC-SHA1
- PHP Object init with: $api = new PBAPI($consumer_key, $consumer_secret)
- Logged In User: pbapi
- Login oauth_token: 32.5726296_264620465
- Login oauth_token_secret: c06406a063b06a06
As well, each example provides raw code and API code. For example:
Ping: GET /ping
Raw Request Example
- <timestamp> = 1208289833
- <nonce> = cc09413d20742699147d083d755023f7
- <method> = GET
- <url> = http://api.photobucket.com/ping
- <params> (None)
- <paramstring> = oauth_consumer_key=1020304&oauth_nonce=cc09413d20742699147d083d755023f7&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1208289833&oauth_version=1.0
- <base> = GET&http%3A%2F%2Fapi.photobucket.com%2Fping&oauth_consumer_key%3D1020304%26oauth_nonce%3Dcc09413d20742699147d083d755023f7%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1208289833%26oauth_version%3D1.0
8.
- <signature> = 2j4y6ocB4d4tTxDoHaNulKpA46c=
- <authedurl> = http://api.photobucket.com/ping?oauth_consumer_key=1020304&oauth_nonce=cc09413d20742699147d083d755023f7&oauth_signature=2j4y6ocB4d4tTxDoHaNulKpA46c%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1208289833&oauth_version=1.0
Raw Response Example
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>OK</status>
<content>
<pong>(read)</pong>
<request>
<oauth_consumer_key>1020304</oauth_consumer_key>
<oauth_nonce> cc09413d20742699147d083d755023f7</oauth_nonce>
<oauth_signature>2j4y6ocB4d4tTxDoHaNulKpA46c=</oauth_signature>
<oauth_signature_method>HMAC-SHA1</oauth_signature_method>
<oauth_timestamp>1208289833</oauth_timestamp>
<oauth_version>1.0</oauth_version>
</request>
</content>
<format>xml</format>
<method>GET</method>
<timestamp>1208289833</timestamp>
</response>
API Example (PHP)
$resp = $api->ping()->get()->getResponseString();
Open topic with navigation