|
|
|
|
|
- Properties specific to apiRequest variables
- Handling different MIME types when requesting a web service
apiRequest (Type of request) In french: apiRequête
The apiRequest type is used to define all the advanced characteristics of a request executed via a REST web service imported using the OpenAPI documentation. These characteristics can be defined and changed using different WLanguage properties. Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable. New in version 2025Req is apiRequest
Req.HTTPHeader["cle"] = "Valeur"
MonWebService.GetListeUtilisateur(Req, param1_WS, param2_WS)
Properties Properties specific to apiRequest variables The following properties can be used to define the characteristics of apiRequest variables: | | | Property name | Type used | Effect |
---|
ClientCertificate | String or buffer | Corresponds to: - a character string with an access path to the .p12 file that contains the certificate to attach to the request. The certificate will be automatically loaded taking into account:
- the certificate in the executable library (if it has been integrated into the application),
- the certificate at the specified location on disk (if the certificate has not been integrated into the executable library).
- a buffer with the certificate (fLoadBuffer).
If this property is set to an empty string (""), the default certificate is reset to "<None>". | HTTPHeader | Associative array of strings | Key/Value set of headers to send. Usage example of this property: cMaRequête.EntêteHTTP["Authorization"] = ...
" WSSE profile=""UsernameToken"""
cMaRequête.EntêteHTTP["X-WSSE"] = ...
"UsernameToken Username=blahblah "
cMaRequête.Entête["Cache-Control"] = " no-cache"
| ClientCertificatePassword | Character string or Secret string | Password associated with the client certificate (empty string by default).
New in version 2025Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI string - Latin". To learn more about secret strings and how to use the vault, see Secret string vault. | ConnectionTimeout | Integer or Duration | Maximum timeout for the connection expressed in milliseconds (20 seconds by default, i.e. 20000 milliseconds). This property can correspond to: - an integer representing the number of milliseconds,
- a Duration variable,
- the duration in a readable format (e.g., 20 s or 20000 ms).
The connection fails if it cannot be established within this period. |
Remarks Handling different MIME types when requesting a web service When using a web service, web service functions can expect different Mime types in their parameters. If the Mime type of the request is different from JSON, serialization is required. Example: - Creation of the element to be passed to the API:
auteur is 'Library Management API'.Author
auteur.id = 12
auteur.name = "Molière"
auteur.birthDate = "16091205"
auteur.nationality = "Français"
- The MIME type of the request is "application/json":
APIReqJSON is apiRequest
APIReqJSON.HTTPHeader["Content-Type"] = mimeTypeJSON
'Library Management API'._authorspost(APIReqJSON,"token",auteur)
- The MIME type of the request is different from application/json (e.g. application/xml): serialization is required:
sAuteur is string
oXml is xmlNode = JSONToXML(auteur)
sAuteur = oXml..XMLSource
APIReqXML is apiRequest
APIReqXML.HTTPHeader["Content-Type"] = mimeTypeXMLApplication
'Library Management API'._authorspost(APIReqXML,"token",sAuteur)
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|