API key: 200a3e048fcbf4c9d6392b99a3bd114af4b3700d API secret: c37912f3900eb26b14aab91d98832b211cdc7791
X-PhotoDeck-Authorization: API key:signatureX-PhotoDeck-Timestamp: current date and time in RFC2822 formatHTTP method (GET, POST, PUT or DELETE) requested URL query string (or empty) API secret copy of the X-PhotoDeck-Timestamp content
http://api.photodeck.com/ping.xml (assuming that you are running a UNIX system with the sha1sum tool installed):In this example, the calculated signature is$ api_key="200a3e048fcbf4c9d6392b99a3bd114af4b3700d"; api_secret="c37912f3900eb26b14aab91d98832b211cdc7791" $ request='/ping.xml'; querystring='' $ timestamp=$(date -R) $ printf "GET\n$request\n$querystring\n$api_secret\n$timestamp\n" | sha1sum | cut -f1 -d' ' f2c14a1936a1732fda757b0870e08b1df792c2a5 $
f2c14a1936a1732fda757b0870e08b1df792c2a5 when executed at Fri, 25 Jun 2010 12:39:15 +0200. The signature should be calculated for every request.X-PhotoDeck-Authorization: 200a3e048fcbf4c9d6392b99a3bd114af4b3700d:f2c14a1936a1732fda757b0870e08b1df792c2a5 X-PhotoDeck-Timestamp: Fri, 25 Jun 2010 12:39:15 +0200
GET http://api.photodeck.com/ping.xml — include the X-PhotoDeck-Auhorization and X-PhotoDeck-Timestamp HTTP headers curl tool:
$ api_key='200a3e048fcbf4c9d6392b99a3bd114af4b3700d'; api_secret='c37912f3900eb26b14aab91d98832b211cdc7791'
$ request='/ping.xml'; querystring=''
$ timestamp=$(date -R)
$ sign=$(printf "GET\n$request\n$querystring\n$api_secret\n$timestamp\n" | sha1sum | cut -f1 -d' ')
$ curl -H "X-PhotoDeck-Authorization: $api_key:$sign" -H "X-PhotoDeck-Timestamp: $timestamp" "http://api.photodeck.com$request${querystring:+?$querystring}"
<?xml version="1.0" encoding="UTF-8"?>
<reply>
<request>GET /ping.xml</request>
<message>OK</message>
</reply>
GET http://api.photodeck.com/ping_auth.xml
$ api_key='200a3e048fcbf4c9d6392b99a3bd114af4b3700d'; api_secret='c37912f3900eb26b14aab91d98832b211cdc7791'
$ request='/ping_auth.xml'; querystring=''
$ timestamp=$(date -R)
$ sign=$(printf "GET\n$request\n$querystring\n$api_secret\n$timestamp\n" | sha1sum | cut -f1 -d' ')
$ curl -H "X-PhotoDeck-Authorization: $api_key:$sign" -H "X-PhotoDeck-Timestamp: $timestamp" -u john@doe.com "http://api.photodeck.com$request${querystring:+?$querystring}"
Enter host password for user 'john@doe.com':
<?xml version="1.0" encoding="UTF-8"?>
<reply>
<request>GET /ping_auth.xml</request>
<message>OK</message>
</reply>
It’s also possible to pass a text=some text parameter to the ping and ping_auth methods (in the query string). You should get the same text back in return, enclosed in a <input-text> tag.