API Calls from the User Portal

This guide covers

  • What Plug-Ins are
  • How to upload your very own Plug-In
  • Introduction to Arcadier's APIs
  • How to add the User’s role as an additional parameter
Runtime: 2:57

Download Code Part 1 (6.9KB) Download Code Part 2 (4.3KB)

 

By downloading this file, you agree that its use is subject to the applicable Terms of Service and You can only use and modify the content in these exercise files with the following agreements: That these files are for Your own personal use for education purposes and to practice the skills to develop on Arcadier. That by using or altering these samples codes, You understand that Arcadier is not responsible for any effects these codes may have on your application, software or environment, both positive or otherwise.

Guide Article

 

This guide will walk you through on how to integrate specific API calls onto the User’s interface for specific roles in the Marketplace. In addition, how to incorporate the various API calls into the Marketplace so that Users of all roles may use them. 

 

Let’s begin: 

Three different types of APIs: 

  • Can be used by all users 
  • Only can be accessed by any Registered User on the Item’s detail page
  • Only can be accessed by Merchants on the homepage

     

    Used by all users

     

    Get All Categories API

     

    This API does not require any authentication so a token is not necessary for this function. Open up the javascript file that contains the majority of your code.

     

     

    We recommend that you have the code written beforehand for easy reference. This part of the code renders the button onto the User’s interface. There is no need for UserID checks as this button should be available to all users including guests.

     

     

    This section of the code associates the button click to its function. It is essentially calling the API and console logging the response. After uploading and installing the plug-in onto your Marketplace, go to your Marketplace homepage to check whether button functions how it is supposed to be.

     

     

      

    Important Note

     

    The plug-in will only execute the code if either of these two conditions are met: 

    • The first condition is whether the User is a Merchant and is currently on the Marketplace’s homepage
    • The second condition is if the User is a Registered account (Buyer or Merchant) and is currently on the item’s detail page 

     

     

    Results

    • Start by logging into your Buyers account and check if the “Add item to Cart” button is there. 
    • Test if the “Add item to Cart” button function works as it is supposed to be

     

      

    This concludes the basics of User Side API calls through the Use of plug-ins.

     

    In the next guide, we will show a more in-depth view on specific API calls called custom fields, which will include another coding language called PHP.