Before you execute a request, you need to configure it first.
The most common things you want to do:
- Construct and add a query string to your URL.
- Set authentication details (username/password, or access token).
- Set custom HTTP headers.
- Add content to the request body.
- Set a request timeout (the maximum time to wait if the server doesn't respond).
The XPRIM_HttpRequest has properties, Options, and Content, through which you can configure the above settings.
Options
The Options property contains members that control the behaviour of the request.
| XPRIM_HttpRequest | HttpClientRequest |
AddBasicAuthorization | Yes | Yes |
AddBearerAuthorization | Yes | Yes |
AddHeader | Yes | Yes |
SetMiscProperty | Yes | Yes |
SetTimeout (method) | Yes | - |
Timeout (property) | - | Yes |
Content
The Content property contains members that allow you to add contents to your request body.
| XPRIM_HttpRequest | HttpClientRequest |
AddFile | Yes | Yes |
AddJson | Yes | Yes |
AddJsonArray | Yes | Yes |
AddJsonObject | Yes | Yes |
AddString | Yes | Yes |
AddUrlEncodedFormValue | Yes | Yes |
AppendString | - | Yes |
ContentInfo (Property) | Yes | Yes |