google.com, pub-6526244334439036, DIRECT, f08c47fec0942fa0

How one can title an API by POSTMAN instrument and map with X3 fields

We come all through the state of affairs, the place we’re going to use POSTMAN software program program instrument  to have a look at the working of exterior API. Postman is a simple GUI for sending HTTP requests and viewing responses. REST suppliers might be present in sage x3 that returns data in a JSON format. On this weblog, we’ll visualize the mapping of fields from postman to x3 Rest internet suppliers.

Occasion: In Postman IDE,

1.HTTP
Request

— Request is the very best method attainable to make http calls.

HTTP
Request contains of Request Methodology, Request URL, Authorization, Request
Header, Request Physique.

a.
Request Methodology: Request methodology defines the type of request to be made.
There are primarily 4 request methods, used for creating/updating, retrieving
and deleting data.

  • POST Request     — For Creating Or
    Updating data
  • PUT Request       — For
    Updating data
  • GET Request       — For
    Retrieving/Fetching data
  • DELETE Request  — For Deleting data.

Choose
Put up Methodology, A POST request is a way that is used when we have now to
ship some additional knowledge contained within the physique of the request to the server.

b.
Request URL:URL to make the http request. Enter all the URL on URL
self-discipline.

c. Authorization: An authorization token, included with requests, is used to ascertain the requester. Select the Main Auth on Type self-discipline and enter official Username and Password.

Fig1: Postman Authorization tab

d.
Request Header: In request headers it contains key-value of the
software program.

Content material material-Type
— A content-type describes the format of object data. Content material material-type, i.e.,
software program/json which is used for the requests and responses

e.
Request Physique: Physique Space  contains
the data, relies upon type of request methodology, to be despatched with request, raw sort
of knowledge is used for sending request. 

{

“title”:”Kalam”,

“job”   :”scientist”

}

2.HTTP Response — On click on on of Ship Button, Response will present in JSON Format.

Fig2: Postman- Physique tab show display screen

In X3:Create
REST Internet suppliers

Navigational Path:
All->Administration->Administration->Rest Internet suppliers

Title Space : Enter any individual outlined self-discipline

Base URL   : Enter
the realm title of the URL

Occasion:
Enter solely space title: http://reqres.in 
from full path:   http://reqres.in/api/clients       

Content material material-Type: Choose Json

Authentication: Choose Main Authentication and Enter credentials ,Username and
password used for authenticate the API

Parameters: PARAM tab in postman is mapped with Parameters fields in X3 as Key value Pair

Fig3: Rest Internet service show display screen

In X3:Beneath
Code Snippet to call exterior API

  ##Declaration of Variables utilized in executing
RestWebservice##

     LOCAL CHAR YAPI(250),YURI(250),PCOD(100)(1..100),

     PVAL(100)(1..100),HCOD(100)(1..100),HVAL(100)(1..100)

     LOCAL CLBFILE YMTD,YREQBODY,YRESBODY,RESHEAD(0)

     LOCAL CLBFILE RESBODY

     LOCAL INTEGER RETVAL

     ##Declaring Header ,Methodology and Path of URL
by Code

     HCOD(1)   = 
“Authorization”

     HVAL(1)    = 
‘”X3User:UserX3″‘

     HCOD(2)   = 
“Content material material-Type”

     HVAL(2)    = 
‘”software program/json”‘

     YMTD   
    =  ‘POST’

     YAPI   
     =  ‘CreateID’

     YURI   
     =  ‘/api/clients’

     YRESBODY = 

     YREQBODY = 
‘{“title”: “Kalam”,”job”:
“scientist”}’

     ##Title EXEC_REST_WS Methodology from
ASYRRESTCLI library carry out

     RETVAL 
= Func
ASYRRESTCLI.EXEC_REST_WS(YAPI,YMTD,YURI,PCOD,PVAL,HCOD,HVAL,YREQBODY,0,”,RESHEAD,YRESBODY)

     IF(RETVAL=201)

        INFBOX NUM$(YRESBODY)

     ELSIF(RETVAL=500)

        INFBOX NUM$(“CONNECTIVITY
ISSUE!!!”)  

     ENDIF

Clarification of
Code snippet:

Header
is specified by Key-value pair, Header ought to incorporate authorization and
content-type particulars.

Assign
the variable HCOD(1)- Header code of array index 1 to Authorization.

Assign
the variable HVAL(1) -Header variable of array index 1 to username and password
separated with Colon.

Assign
the variable HCOD(2)- Header code of array index 2 to Content material material-type.

Assign
the variable HVAL(2)- Header variable of array index 2 to software program/Json.

Assign
the variable YMTD-Form of Methodology used  to
string value “POST”

Assign
the variable YAPI -REST internet service Title to ” CreateID “

Assign
the variable YURI with the remaining part of URL

merely
declare Response physique variable

and
Assign the YREQBODY variable to enter

title
EXEC_REST_WS carry out from ASYRRESTCLI library with all required parameters and
will return standing code as integer value which displays success or failure and
finish outcome json format is saved in YRESBODY Variable.

IMPORTANT
NOTE:

If
there could also be an requirement of sending Username and password immediately by code
with out passing in REST webservices. Clarification with state of affairs,

From
Login authentication show display screen, whether or not it’s worthwhile then go these credentials to
the REST internet suppliers by code, In that case Header variable ought to incorporate

Header
Code HCOD(1) as “Authorization” and

Header
Val HVAL(1) as ” Main MTcwZWU5MmEyODOTo= “

String
“Main” adopted by BASE 64 format of Username: Password

Refer
the weblog for the ASYRRESTCLI carry out and its parameters to be handed for the
carry out

“The narration of carry out and its parameter used to call an exterior/outgoing REST internet service from ASYRRESTCLI library”

Few Guidelines of Standing
Code and its description

1.200          -Worthwhile request.

2.201          -Worthwhile request and knowledge
was created.

3.204          -Empty Response.

4.400         -Harmful Request.

5.401        -Unauthorized entry

6.403         -Forbidden, Entry denied.

7.404          -Data not found.

8.405          -Methodology Not Allowed or
Requested methodology is simply not supported.

9.500          -Inside Server Error.

10.503 
     -Service Unavailable.

Response from API whereas executing the code above in X3.

Fig4: API Response show display screen in Sage X3

This weblog helps us to know the mapping of fields from POSTMAN instrument to X3 REST internet suppliers and code used to call an exterior API by the usage of EXEC_REST_ES carry out by passing credentials in header variables.

About Us

Greytrix – a globally acknowledged and certainly one of many oldest Sage Gold Progress Affiliate is a one-stop reply provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we ship full end-to-end assist in your technical consultations, product customizations, data migration, system integrations, third-party add-on enchancment and implementation competence.

Greytrix caters to a wide range of Sage X3, a Sage Enterprise Cloud Decision, selections. Our distinctive GUMU™ integrations embody Sage X3 for Sage CRMSalesforce.com, Dynamics 365 CRM and Magento eCommerce along with Implementation and Technical Assist worldwide for Sage X3. In the intervening time we’re Sage X3 Implementation Affiliate in East Africa, Middle East, Australia, Asia, US, UK. We moreover present best-in-class Sage X3 customization and development services, built-in functions equal to POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons equal to Catch – Weight  and Letter of Credit and India Legal guidelines for Sage X3 to Sage enterprise companions, end clients and Sage PSG worldwide.

Greytrix is a acknowledged Sage champion ISV Affiliate for GUMU™ Sage X3 – Sage CRM integration moreover listed on Sage Marketplace; GUMU™ integration for Sage X3 – Salesforce is a 5-star rated app listed on Salesforce AppExchange and GUMU™ integration for Dynamics 365 CRM – Sage ERP listed on Microsoft AppSource.

For additional knowledge on Sage X3 Integration and Suppliers, please contact us at x3@greytrix.com, We’re going to prefer to hearken to from you.

Leave a Reply

%d bloggers like this: