Sample Repository Implementation using Acenda SDK

Raw Curl Authentication/Token Generation.

 

NOTE: Download and open these CURL examples on authentication, tokens and request.

  1. base_example.php
  2. implemeting_example.php

With the exception of the oauth endpoint, all requests are made to a url following this structure:

https://admin.acenda.com/preview/{store_hash}/api/{function}?access_token={token}

 

store_hash is an md5 of the store name (This is the name in the URL of admin.acenda.com)

function corresponds to a method in the api documentation (http://doc.acenda.com)

Token is the token received after performing request #1 below

 

Please Note: The sample URLs below will require the information mentioned above changed to work against your test store

 

1) Generate Oauth Credentials

curl -X POST https://acenda.com/oauth/token -d "username=[email]&password=[password]&grant_type=password"

 

Response:

{"access_token":"2753f5d1e1685f293bbe1b88ca56f889bf4ec79f","expires_in":86400,"token_type":"Bearer","scope":"bones_administration","refresh_token":"ffa8ac22782d6e8a35cb4a489c7dbd98c3a9dd4a","refresh_expires":172800}%

 

2) Use the refresh token to update your Oauth token when it expires (optional or you could just repeat step 1)

curl -X POST https://acenda.com/oauth/token -d "client_id=[email]&refresh_token=7e1786b14b7272270191bea11aae4a311b858c12&grant_type=refresh_token"

 

3) Return only order id's

curl "https://admin.acenda.com/preview/2907bc770bdbe68e5023785068c2aa67/api/order?access_token=a63c3a9437b6f4d2ef650b9b1b95a2320cbcfdf4&attributes=id"

 

Response:

{"code":200,"status":"OK","execution_time":0.29929518699646,"num_total":3,"result":[{"id":3508640},{"id":3508642},{"id":3508644}]}%                           

 

4) Query an Order for all information

curl "https://admin.acenda.com/preview/2907bc770bdbe68e5023785068c2aa67/api/order/3508640?access_token=a63c3a9437b6f4d2ef650b9b1b95a2320cbcfdf4"

 

5) Query for orders from a specific time frame

curl 'https://admin.acenda.com/preview/2907bc770bdbe68e5023785068c2aa67/api/order?access_token=a63c3a9437b6f4d2ef650b9b1b95a2320cbcfdf4?limit=20&page=1&sort=date_created:-1&attributes=id&query=\{"date_created":\{"$gt":"2016-08-01T11:48:00-07:00"\}\}

 

Attachments

Was this article helpful?
1 out of 2 found this helpful
Have more questions? Submit a request

There are 0 Comments

Please sign in to leave a comment.