Introduction to Arcadier’s APIs

Arcadier is an API-first company, where the existing and new features on Arcadier’s Marketplace Platform will have the corresponding APIs created. There is significant versatility and flexibility in the application of Arcadier’s APIs so the possibilities will depend on the imagination of the developer using the APIs. You can view our sample code examples to see a few applications which have been created using Arcadier’s APIs. Our APIs form the backbone of our system, as they define the method and process of how our Marketplaces function. To learn more about Arcadier’s APIs, please visit our API References section. To view our APIs directly, you can download the free Postman app and retrieve our Postman Collection.

 

Image: Arcadier’s API V2.0 Library

Basics to APIs

All our API's are documented on Postman as well. The whole collection can be downloaded from here

Go to Postman

API References covers the basics of Arcadier's APIs and explains how you can call , authorise and implement them into your marketplace. For a more in-depth guide on how to create flows and manage things like Users, Orders and Inventory via APIs and Plug-Ins, you may refer to our Advanced API References here.

 

function getCookie(name){
     var value = '; ' + document.cookie;
     var parts = value.split('; ' + name + '=');
     if (parts.length === 2) {
         return parts.pop().split(';').shift();
     }
 }
 var token = getCookie('webapitoken');
 var settings = {
     "url": "", 
     "method": "", 
     "headers": { 
         "Content-Type": "",
         "Authorisation": "Bearer" + token
     }, 
     "data": ""
 };
 $.ajax(settings).done(function(response) { console.log(response); });

 

WHAT YOU NEED TO KNOW

We only support HTML, CSS, JavaScript and PHP for customization. Be sure to check the several example codes that we have by clicking on the dropdowns.

 

HIERARCHY OF USERS

When using an API, you should try to use it as the user who was intended to do the action.

For example:

  • Admins own the marketplace so they have control over almost everything and everyone else on the marketplace.

  • Merchants are the sellers of the marketplace. So they have control over their user information, their items/services that they are offering, and the transactions they want to do.

  • Buyers are the consumers, so they have control over only their information.

 

TOKENS

We have an Authentication API that responds with an admin token and the Admin GUID (Globally Unique IDentifier). This takes sensitive information as input and returns admin token and GUID.

Tokens can also be obtained using the snippet below. If the code is running on client side, then it gets the user's token from the cookie stored locally. It is passed as a parameter using the Bearer + token method.

 

USER IDS

Admin, Merchant and Buyer ID's can be found by inspecting the page when logged in as each of them. The value of the userGUID is the ID used in APIs.

Authentication

Check out this API in postman >

 

Our APIs use the Bearer token authentication method. The token can be generated in 2 ways:

  1. By API
  2. Using the cookie

 

Generating the token via API

We have an Log In/Get Admin Token API that responds with a user's access_token which can be used as token to authenticate our APIs. The API takes Client ID and Client Secret as input. See the API's details in the link.

Documentation of this API can be found here.

 

https://{{your-marketplace}}.arcadier.io/token

 

var settings = {
  "url": "https://{{your-marketplace}}.arcadier.io/token",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "client_id": "",
    "client_secret": "",
    "grant_type": "client_credentials",
    "scope": "admin"
  }
};
$.ajax(settings).done(function (response) {
  console.log(response);
);

 

EXAMPLE RESPONSE:

{
  "access_token": "W0epUTVx5oFTadxY7mqiJIiXFIxd1C-RI8P9Ll-K29l4mT2lF0of933_gAtVcwxsBkLk4tC3a3yNidzH6wk2YdieHoM-JwmrblrDgTT8-bhE04MNktzmPlZmIYDwvzo2Ad5f5LRwP8DI9gAfQ4RmeSBm35pWbC7raZS0zTVAiKCf0-K9wJsMiwOnqfjtseb80HTCazEFZHcUGKzeoPw1dWeGRQ2U3vQ__LZtG1eLzz2ivUpW2vG69zN8DINlZCrL_GNknM0oosXvhTehLWM7Jt6P-PNYzvZUCPBJHRcVSOM4WV_v3Du7ZCy2gXRmmXAEFqeacGkcTJHRz1DVM3gR9kFlaBmMSAIFC_vKSrmzn6FhZ9mSXXWbtUsfHLh7cpa1k0IcYhCzLsfZ_32J3uSK6gd3UpT_ijJOmc_tVjPImdFDcxSTXc_JhfiNFqhJ9C8mRGSEZZykS8I3wi3QwGVLuFFwgU5fXmEnE10bxeuVVI3HYXl-Z6wx7I0KnVM6rcGF7fPh5-d9pVffnBoTYyld_palMyOf1OtnjHD-n4OLwLmkRUPnuq2Bs54CEau0_qFd4r71GlgLeZr-gBUIqLyOcDwk0IsgIuz2eDE37V_LHGUBuj68cc-yM5dR-MqaBkRJ1wpxjgTPeApFs67v9RYAONTtsdfwvuY7odsaGQvdG9owednDKKiv7lNOX7buzgXZSXeQklXYZScBp_gbl_16KdigQxPLYSn02j1THdNir_Dt2DofNBMv2qpmslgSbd7iFSVaKA",
  "token_type": "bearer",
  "expires_in": 10799,
  "refresh_token": "98b93750a4054d8db242e5ab4491c323",
  "UserId": "e1676334-1724-45e3-b5fd-5481a3537b45"
}

 

Fetching the token from Cookie

Tokens can also be obtained using the snippet below. If the code is running on client side, then it can get the user's token from the cookie stored locally. It is passed as a parameter using the Bearer + token method.

This token can now be used throughout your script every time it's run.

 

function getCookie(name){
    var value = '; ' + document.cookie;
    var parts = value.split('; ' + name + '=');
    if (parts.length === 2) {
        return parts.pop().split(';').shift();
    }
}
var token = getCookie('webapitoken');

Arcadier APIs are RESTful

One of the flexible aspects of Arcadier’s APIs is that they are RESTful. To access and call them, visit our list of APIs to learn more about how to implement them into your codes. They allow for the standard API Methods of “GET”, “PUT”, “POST”, and “DEL”, and only require a URI to access. The majority of our APIs use the Bearer token authentication method to authorize user API requests. Furthermore, some of our APIs maintain limited access based on the user’s role as an additional level of security.

 

Ways to Utilise Arcadier APIs

Arcadier APIs can be implemented in two ways:

 

  • Apply the APIs via the Custom Code Editor, Javascript Editor Panel function.

  • Apply the APIs via the Developer Dashboard. 

 

Applying the APIs through the Custom Code Editor by going through a Marketplace Admin Portal is the “Client Side” application, as the codes which you apply can be seen in the Admin Dashboard’s Custom Code Editor, and will be exposed to any Marketplace Administrator who has access to the portal. We recommend the custom code editor to be used only for slight user flow tweaks and user interface changes. 

 

Applying the APIs through the Developer Dashboard via the creation of plug-ins is the “Server Side” application. To create a plug-in, you will need to contact Arcadier’s engineers to request to get a Developer Dashboard and create a Sandbox Marketplace. We recommend that you create a plug-in when you are dealing with huge, extremely segmented code, which might include calls done in PHP (secure code/information). This will keep your code safe from being altered or damaged. 

 

If you are just testing the Arcadier APIs in order to explore its capabilities, you do not need to apply for a Sandbox Developer Dashboard if you do not want to, but instead choose to directly utilise the Custom Code Editor on your Sandbox Marketplace to apply the APIs and test its capabilities. 

Arcadier’s Github Resources

Arcadier’s Github contains in-depth documentation on how to include, incorporate and implement Arcadier APIs to your code. If you do have a question, you can also seek support from our Arcadier Github Developer Community. You can browse through the documentation to learn more about how Arcadier’s features work.

 

 

Image: Arcadier Github Resources



Here are some quick links to our Github resources: