View Article

Create an Access Token and Consume Post Web API File

By Xelence Documentation posted 12-06-2021 16:17

  

Introduction

If you want users to be able to post the data or consume the data from the specified resource, you must create the Consume Web API file. This allows you to add, edit and delete the fields, objects, and collections that you want to post to the specified resource.

To create a Consume Web API file, you must first create an access token. This contains authorization details along with the URL of the specified resource.

Prerequisites

  • The URL of the API which is going to be used.
  • Access Token has to be created before creating a Consume Web API file.
Quick Steps
1 Open the Configuration window
2 Open the Access Token section
3 Create an access token
4 Enter the details, then click Create
5 Save the access token
6 Click the Create New Item icon, then select the Object Type
7 Select the Web API Type
8 Enter the details, then click Finish

Detailed Steps

Step 1. Open the Configuration window.

Click the Configuration icon in the top right corner of the landing page. 



Step 2. Open the Access Token section.

This is where you are going to create an access token.



Step 3. Create an access token.

Click the + icon to add the access token. Xelence opens the wizard to select the desired type of access token.

Select other from the available options and click Next.



Step 4. Enter the details, then click Create.

The important properties are:

  • Name (ID): Name of the access token.
  • URL: This is the URL from the specified resource that you are going to consume.
  • Authentication Type: Defines how the token authorizes. Select from the below options:
    • No Auth: No authorization details are required to authenticate the API. This example uses this authentication type.
    • Basic: Username and password can be used to authenticate the API.
    • Bearer: Includes security token and allows access only to the bearer of the token. Bearer token is a cryptic string, usually generated by the server in response to a login request.
    • ApiKey: In this type, you need to send the Key-Value pairs(s) in Auth Headers or Query Params.
    • OAuth2: Two-step authentication. In this type, you need to enter the below details:
      • Token URL: The provider's authentication server, to exchange an authorization code for an access token.
      • Auth URL: The endpoint for the API provider authorization server, to retrieve the auth code.
      • Client ID: An identifier associated with an application that is registered with the API provider.
      • Client Secret: Specifies a secret provided by the API provider.
      • Scope: Specifies the scope of access you are requesting, which may include multiple space-separated values.
      • Grant Type: It is used to authorize access to protected resources in different ways. Select from the below options:
        • Authorization_code: It is used by confidential and public clients to exchange an authorization code for an access token. After the user returns to the client via the redirect URL, the application will get the authorization code from the URL and use it to request an access token.
        • Client_credentials: It is used by the clients to obtain an access token outside of the context of a user. This is typically used by clients to access resources about themselves rather than to access user's resources.
        • Refresh_token: It is used by clients to exchange a refresh token for an access token when the access token has expired. This allows the clients to continue to have a valid access token without further interaction with the user.
        • Device_code: It is used by browserless or input-constrained devices in the device flow to exchange a previously obtained device code for an access token.
      • Content Type: Determines which type of content it is returning. Select from the below options:  
        • Application_json: The content sent or received is the JSON data.
        • Application_urlencoded: The content sent or received is encoded data as key value pairs separated by '&'.
      • Token Name: Name of the OAuth token used to identify the access token in the authorization request or response.
      • Custom Attributes: Allows you to include custom key value pair like Client ID, client secret, etc. that can be used as part of authentication.
      • Add Private Key: Allows the client to authenticate itself to the authorized server using signed JSON Web Token. If checked, displays the below properties:
        • Token Descriptor: Describes the structure and content of the JWT token used.
        • Algorithm: Specifies the algorithm used to sign or encrypt the JWT.
        • Private Key: It is a method of client authentication where the client creates and signs a JWT using its own private key.



Step 5. Save the access token.

When you click the Create button, Xelence creates and displays the access token. 

Click the Save icon. 

Click OK.



Step 6. Click the Create New Item icon, then select the Object Type .

This opens a dropdown list from which you can select an object to begin its item wizard. The item wizard creates a file or files. The object type identifies the file the wizard will create. Here, you are creating a Web API file.



Step 7. Select the Web API Type.

You are creating a Consume Web API file.



Step 8. Enter the details, then click Finish.

The important properties are:

  • Name (ID): Name of the Web API file. It will always be prefixed with wpi.
  • Select Folder: This is where Xelence will save the file. You can select an existing folder.
  • Access Token: An identifier used to create the Web API file.
Then, click the Finish button to create the file.


Xelence creates the Consume Web API file and is available for further configuration.

When you have completed the wizard and created your file, it should look something like this:


What are the improvements over S3 Version 6?

This is a new process.


Related Articles

Configure the Consume Post Web API File


This post is part of the Web API topic. Click here to open Web API Overview


#Develop
#Development Studio

#Task Steps
#Everyone
#Text Help

#Xelence

#API

#WebAPI

0 comments
86 views