Safe Stamper Web API: Difference between revisions
Jump to navigation
Jump to search
w>Jguillo No edit summary |
w>Jguillo No edit summary |
||
Line 5: | Line 5: | ||
To get your pair of API keys, you can contact us through [[Safe Stamper contact form | https://www.safestamper.com/contact]] | To get your pair of API keys, you can contact us through [[Safe Stamper contact form | https://www.safestamper.com/contact]] | ||
= Parameters signature = | |||
Some API operations require a signature to authenticate the API client. | |||
To calculate the signature, follow this steps: | |||
* Build a string with all parameters ordered alphabetically, separated by ''&'' and '''without url-encoding''' | |||
* Get the bytes of the string, using UTF-8 encoding | |||
* Get the bytes of your private key, using UTF-8 encoding | |||
* Calculate the HMAC-SHA1 of the string bytes, with your private key bytes | |||
* Encode the signature bytes as hexadecimal digit pairs | |||
== Example == | |||
Parameters: | |||
* sharedkey = 789lq9o6im682tl0m1rej34ls | |||
* url = https://www.google.com/search?q=Safe+Stamper&gws_rd=cr,ssl | |||
Private key: 1omnpo704w6u2ad2lxo2wrdm5 | |||
String to sign: sharedkey=789lq9o6im682tl0m1rej34ls&url=https://www.google.com/search?q=Safe+Stamper&gws_rd=cr,ssl | |||
Content bytes (hexadeximal): | |||
<pre> | |||
73 68 61 72 65 64 6b 65 79 3d 37 38 39 6c 71 39 |sharedkey=789lq9| | |||
6f 36 69 6d 36 38 32 74 6c 30 6d 31 72 65 6a 33 |o6im682tl0m1rej3| | |||
34 6c 73 26 75 72 6c 3d 68 74 74 70 73 3a 2f 2f |4ls&url=https://| | |||
77 77 77 2e 67 6f 6f 67 6c 65 2e 63 6f 6d 2f 73 |www.google.com/s| | |||
65 61 72 63 68 3f 71 3d 53 61 66 65 2b 53 74 61 |earch?q=Safe+Sta| | |||
6d 70 65 72 26 67 77 73 5f 72 64 3d 63 72 2c 73 |mper&gws_rd=cr,s| | |||
73 6c |sl| | |||
</pre> | |||
Key bytes (hexadecimal) | |||
<pre> | |||
31 6f 6d 6e 70 6f 37 30 34 77 36 75 32 61 64 32 |1omnpo704w6u2ad2| | |||
6c 78 6f 32 77 72 64 6d 35 0a |lxo2wrdm5.| | |||
</pre> | |||
HMAC-SHA1 | |||
<pre> | |||
3e e8 b6 11 39 50 c0 c8 49 4b a0 3b 4f b8 d6 16 c7 fb 9a 25 | |||
</pre> | |||
Signature: 3ee8b6113950c0c8494ba03b4fb8d616c7fb9a25 | |||
= API operations = | = API operations = |
Revision as of 13:51, 15 April 2016
API keys
To use Safe Stamper Web through API, you need a pair of keys:
- A shared key that identifies your client application
- A private key used for signing your requests
To get your pair of API keys, you can contact us through https://www.safestamper.com/contact
Parameters signature
Some API operations require a signature to authenticate the API client.
To calculate the signature, follow this steps:
- Build a string with all parameters ordered alphabetically, separated by & and without url-encoding
- Get the bytes of the string, using UTF-8 encoding
- Get the bytes of your private key, using UTF-8 encoding
- Calculate the HMAC-SHA1 of the string bytes, with your private key bytes
- Encode the signature bytes as hexadecimal digit pairs
Example
Parameters:
- sharedkey = 789lq9o6im682tl0m1rej34ls
- url = https://www.google.com/search?q=Safe+Stamper&gws_rd=cr,ssl
Private key: 1omnpo704w6u2ad2lxo2wrdm5
String to sign: sharedkey=789lq9o6im682tl0m1rej34ls&url=https://www.google.com/search?q=Safe+Stamper&gws_rd=cr,ssl
Content bytes (hexadeximal):
73 68 61 72 65 64 6b 65 79 3d 37 38 39 6c 71 39 |sharedkey=789lq9| 6f 36 69 6d 36 38 32 74 6c 30 6d 31 72 65 6a 33 |o6im682tl0m1rej3| 34 6c 73 26 75 72 6c 3d 68 74 74 70 73 3a 2f 2f |4ls&url=https://| 77 77 77 2e 67 6f 6f 67 6c 65 2e 63 6f 6d 2f 73 |www.google.com/s| 65 61 72 63 68 3f 71 3d 53 61 66 65 2b 53 74 61 |earch?q=Safe+Sta| 6d 70 65 72 26 67 77 73 5f 72 64 3d 63 72 2c 73 |mper&gws_rd=cr,s| 73 6c |sl|
Key bytes (hexadecimal)
31 6f 6d 6e 70 6f 37 30 34 77 36 75 32 61 64 32 |1omnpo704w6u2ad2| 6c 78 6f 32 77 72 64 6d 35 0a |lxo2wrdm5.|
HMAC-SHA1
3e e8 b6 11 39 50 c0 c8 49 4b a0 3b 4f b8 d6 16 c7 fb 9a 25
Signature: 3ee8b6113950c0c8494ba03b4fb8d616c7fb9a25
API operations
All operations return their results in JSON format.