httpPost(url, data, [options]) Last updated: 01. May 2026
API only function
Calls specified web service and expects JSON. Parses JSON to object.
Parameters
| Name | Type | Description |
|---|---|---|
| url | string | URL to call with HTTP POST. |
| data | object | Object that will be passed as JSON body. |
| options (optional) | object | Specify any of the following options parameters: |
| • headers | object | Name / value object that will be converted to HTTP headers. |
Returns
Returns JSON parsed object.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.// Basic authentication
let options = {
"headers" : {
"Authorization" : "BASIC " + docly.base64(login + ":" + password)
}
};
// Call some API
var result = docly.httpPost("https://somewebsite.com/API/Call?id=1", data, options);
// Output result
return JSON.stringify(result);