-
Notifications
You must be signed in to change notification settings - Fork 4
Partner API
Theo Mills edited this page Jul 9, 2014
·
12 revisions
The Partner API is not open to the general public. If you are interested in a ShippingEasy Partner API account, please contact support@shippingeasy.com.
First you will need to create an API signature. Concatenate these into a plaintext string using the following order:
- Capitilized method of the request. E.g. "POST"
- The URI path
- The query parameters sorted alphabetically and concatenated together into a URL friendly format: param1=ABC¶m2=XYZ
- The request body as a string if one exists
All parts are then concatenated together with an ampersand. The result resembles something like this:
"POST&/partners/api/accounts&api_key=f9a7c8ebdfd34beaf260d9b0296c7059&api_timestamp=1401803554&{\"orders\":{\"name\":\"Flip flops\",\"cost\":\"10.00\",\"shipping_cost\":\"2.00\"}}"
Finally, using your Partner API secret encrypt the string using HMAC sha256. In ruby, it looks like this:
OpenSSL::HMAC::hexdigest("sha256", api_secret, "POST&/partners/api/accounts&api_key=f9a7c8ebdfd34beaf260d9b0296c7059&api_timestamp=1401803554&{\"orders\":{\"name\":\"Flip flops\",\"cost\":\"10.00\",\"shipping_cost\":\"2.00\"}}")
You must include an API timestamp in your requests. The timestamp should be an integer representation of the current time.
curl -H "Content-Type: application/json" --data @body.json "https://app.shippingeasy.com/partners/api/accounts?api_key=f9a7c8ebdfd34beaf260d9b0296c7059&api_timestamp=1401803554&api_signature=c65f43beed46e581939898a78acd10064cfa146845e97885ec02124d7ad648e4"
An example body.json can be found here: