GSD NET-Sxp Sample requests guide


You're able to execute request to NET-sxp using cURL. cURL is a free, open-source software used to transfer data using Internet Protocols for the given URL. You can execute requests using command line in windows operation system or execute it in your own application. The way of using cURL on your own application, depends on technology which you use to create your app. Below you can see sample requests to NET-sxp webservice. You can just pass those commands to the command prompt in operation system, set the values and then run.
CURL documentation

api/v1/login/via-token/:token

First you should obtain JWT token. To get valid JWT token for given SXP endpoint you should provide token set in NET-sxp endpoint configuration. In the response you get JWT, so you will be able to call execute macro requests

1
curl -XPOST -H "Content-type:application/json" "http://localhost:8080/api/v1/login/via-token/tokenFromNETsxpConfig"

/api/v1/execute/:macro

After obtaining JWT token, you can call execute macro requests e.g. get articles list from the ERPframe

1
curl -XPOST -H "Content-type:application/json" -H "Authorization:Bearer yourJWTToken" -d  "[    {\"name\":\"artikelids\", \"type\": \"C\", \"value\": \"1713\"} ]" "http://localhost:8080/api/v1/execute/GETARTIKELDATEN"

api/v1/_CheckService

Call _CheckService to validate NET-sxp installation

1
curl -XGET "http//localhost:8080/api/v1/_CheckService"

Axios

Below you can see sample JavaScript code to make a HTTP request using axios library. Axios allow programmer to make a HTTP request both from the browser and node.js application.
Axios documentation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
const config = { 
    headers: { 
        'Content-Type': 'application/json',
        'Authorization': 'Bearer yourJWTToken'
    }
};

axios.post('http://localhost:8080/api/v1/execute/GETARTIKELDATEN', [{"name":"artikelids", "type": "C", "value": "1713"}], config)
.then(function (response) {
    console.log(response);
})
.catch(function (error) {
    console.log(error);
})
.finally(function () {

});