CRUD Operations
To execute an HTTP request to the SmartService and test the parameters to send and the responses obtained, the simplest thing to do is to install the Postman application, which is freely downloadable for all platforms or can also be installed as an internal application in the Chrome browser. The examples below are based on this program, although it is possible to use any program or utility capable of generating HTTP requests, such as CURL.
Reference Endpoint
Enterprise SmartServices resources are installed to respond to the server URL.
Handle Authentication
To test the service, you need to use the Bearer Token issued during the login phase.
Declare the Scope
You must specify an additional mandatory authentication parameter called Authorization-Scope. This required parameter must be defined as an additional header in the HTTP request, and its value must match the “environment” parameter specified in the URL.
Customize the Request
You can specify two additional optional parameters in the HTTP request headers to modify the standard behavior of the service:
Accept: defines the serialization format for input/output parameters. Possible values are:application/json: the data returned by the service (GET: read) or accepted as input (POST: create or PUT: update) is serialized in JSON format.
This is the default format, used if the Accept header is not specified.
-
application/xml: the data returned by the service (GET: read) or accepted as input (POST: create or PUT: update) is serialized in XML format. -
Accept-Encoding: if present and containing the valuegzip, compress, the HTTP response is compressed in GZIP format to speed up data transfer. -
Accept-Language: if present and set with an IETF language code (such asit,enoen-USamong many others), it sets the system language and therefore the error and/or validation messages.
The default language, used if the Accept-Language header is not specified, is Italian.
The WebApi service response contains the headers Content-Type, Content-Language and Content-Encoding, which can be used to decide how to deserialize the obtained data.