NSOA.https.patch(request)
Use this function to send an HTTPS PATCH request to update or to make partial modifications to resources on a server. PATCH requests may support both query string parameters and a request body. The exact use of PATCH requests and what data is returned depends on the implementation of the server. The function will return an error if the URL requested does not use the HTTPS protocol. The function will follow redirects up to a maximum of 7. The response must not exceed 1MB in size.
If the client doesn’t start receiving a response from the server within 45 seconds of the request being fully sent, a connection timeout occurs. If the request times out, a response object is returned with a standard HTTP Status Code (500) and a "Client-Warning" header set.
Parameters
-
request {object} [required] — The request object is used to set the PATCH request parameters
Property |
Type |
Required / Optional |
Description |
---|---|---|---|
url |
string |
required |
The HTTPS URL being requested. |
body |
array|object|string |
optional |
The PATCH data. If the data is passed as an array or object, it will be automatically JSON serialized and URL encoded. |
headers |
object |
optional |
The HTTPS headers. The MIME type is set automatically to application/json when body is an array or object. |
Returns
-
response {object} [read-only] — The NSOA.https.patch function returns the response object.
Property |
Type |
Description |
---|---|---|
body |
object|string |
The response body. |
code |
string |
The HTTP response status code. |
headers |
object |
The response headers. |
Units Limit
-
10 units
For more information, see Scripting Governance.
Since
-
October 12, 2019
Example
-
This example sends form data to an endpoint using the HTTPS PATCH method, converts the response to a JSON string, displays it in a confirmation message and stores it as a log entry.
function main(type) { var response = NSOA.https.patch({ url: 'https://postman-echo.com/patch, body:'This is expected to be sent back as part of response body.' }); NSOA.meta.alert(JSON.stringify(response)); NSOA.form.confirmation(JSON.stringify(response)); }
See Code Samples for more examples.