.NET for Easit GO WebAPI
Basics
To get a basic understanding of the WebAPI in Easit GO we recommend you to start with reading the following articles before jumping ahead.
In this article we will only use the REST endpoint (/integration-api) in Easit GO and therefor only use JSON examples.
You can find the specification of the models used for requests and responses here.
Variables
We start by setting some variables that can be used later in our program.
1 2 3 4 |
|
Client
We then create a new HTTP client that we will send the request with.
1 2 3 4 |
|
Request
We create a new HTTP request message.
1 |
|
Authorization
When we call Easit GO WebAPI, we need to authentication our self and therefor add a authentication header to the request.
1 2 3 |
|
HTTP Methods
Depending on what type of request (GET objects from Easit GO or POST object to Easit GO) we would like to send, we set the appropriate method.
1 2 3 |
|
Basic GET request
In our GET example we would like to get the first page from the view and that would look something like this. new GetItemsRequest() will generate a correctly formatted object that we then use to create JSON content with, and set that JSON content as the content of the request.
1 |
|
Basic POST request
In our POST example we would like to post a simple object with 2 properties to Easit GO, more specifically the importhandler importhandlerToImportObjectWith, with the id 1. The id can be anything you want, it is only and id for the object in the request body.
1 2 3 4 5 6 7 8 9 10 11 |
|
Set the content of the request
Once we have a request body we set it as the request message content as JSON content.
1 |
|
Send request and read response
We then send the request to Easit GO and read the response if the status code indicated success.
1 2 3 4 5 6 7 8 9 10 11 |
|