So, what is an API?
API is the acronym for application programming interface — a software intermediary that allows two applications to talk to each other. So, with the help of API two applications can communicate and share information with each other.
Application can communicate by Sending HTTP Requests.
HTTP is a protocol for request-response between client and server.
Client – The one to send the request
Server- One who sends the response after processing the request.
HTTP Requests
Below listed are some types of HTTP requests.
What are HTTP Headers?
HTTP headers provide additional information about the data being sent in a request or response. They convey details such as content type, encoding, authentication, and caching instructions. Using headers helps in enhancing communication between the client and server, enabling better control, security, and optimization of the data exchange process.
They convey additional information without altering the core payload (body), enabling more efficient and secure data exchange between clients and servers.
While the request body is part of the request message carrying data from the client to the server.
What is API Authentication
So, to communicate to the API we need to authenticate ourselves. There are various ways to authenticate, depending on the ways permitted by the service provider.
Examples are API Key, bearer Token (OAuth).
Web Service API Integration in NAV
In Navision, we can use Codeunit -Http Web Request Mgt. , this code unit provides us with the methods to send the HTTP request.
Further to store the response we need to have InStream , HTTP Status code, HTTP Response Headers variable with us.
Then we can convert our instream response into text and process the response as per our requirement.
Instr.READTEXT(AccessToken);
An Example is shown in the below screenshot as well –
After this point it is just that we need to read the response as per our requirement and the structure of Json response.
For more details like this please follow our company LinkedIn page where you will get all the new updates
every week:
https://www.linkedin.com/company/allgrow-technologies-pvt-ltd/mycompany/
or you can write us at contact@allgrowtech.com
Author