Call the WooCommerce API
const url = 'https://digize.com/api/v1/integrations/woocommerce/request';const options = { method: 'POST', headers: { 'Idempotency-Key': '5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69', 'x-api-key': '<x-api-key>', 'Content-Type': 'application/json' }, body: '{"method":"GET","url":"example","query":{"additionalProperty":["example"]},"headers":{"additionalProperty":"example"},"body":"example","content":{"upload":"example","range":{"first":1,"last":1},"text":"example","type":"example"},"files":[{"field":"example","upload":"example","range":{"first":1,"last":1},"filename":"example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://digize.com/api/v1/integrations/woocommerce/request \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \ --header 'x-api-key: <x-api-key>' \ --data '{ "method": "GET", "url": "example", "query": { "additionalProperty": [ "example" ] }, "headers": { "additionalProperty": "example" }, "body": "example", "content": { "upload": "example", "range": { "first": 1, "last": 1 }, "text": "example", "type": "example" }, "files": [ { "field": "example", "upload": "example", "range": { "first": 1, "last": 1 }, "filename": "example" } ] }'Calls WooCommerce’s own API on the workspace’s behalf, signed in with its WooCommerce connection, and returns what WooCommerce answered: any endpoint the connection reaches, with any method, query and body. WooCommerce’s errors come back as its answer, with their status. A file goes by upload: put it with integrations.files.createUpload, then name it in content (the whole body), files (a multipart form), either with a range of its bytes, or as { “$upload”: id } inside body (base64 in JSON). A file WooCommerce answers with comes back as base64, and the answer has WooCommerce’s headers. The store’s WooCommerce REST API v3, at
Needs the settings:write permission.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.
Example
5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69Request Bodyrequired
Section titled “Request Bodyrequired”object
The endpoint’s method.
A full URL under one of the API’s base URLs, or a path starting with /, which goes after the first.
Query parameters, added to any already in the URL.
object
Only headers the description says a call may set. The call is signed in without any.
object
The body: JSON, or a form’s fields for an API that takes forms. A value { “$upload”: “files, an object field goes as a JSON part.
The whole body, sent exactly as given instead of body: an upload’s file, such as a PDF PUT to Click2Mail’s Batch API, or text. Give upload or text.
object
An upload’s id, from integrations.files.createUpload.
Only these bytes of the upload, both included, such as a LinkedIn video part’s firstByte and lastByte, or a chunk of a resumable upload. Left out, the whole file.
object
The first byte, from 0.
The last byte, included.
Text, such as XML. Past 200,000 characters, upload it.
The body’s content type, such as application/xml. Text needs one; an upload goes as the type it was uploaded with unless this says.
Uploaded files, sent as multipart/form-data with body‘s fields as the form’s other fields, such as Click2Mail’s /molpro/documents upload. A field whose value is an object goes as a JSON part, as QuickBooks’ and Salesforce’s uploads take a file’s details.
object
The form field it goes in, such as file.
An upload’s id, from integrations.files.createUpload.
Only these bytes of the upload, both included, such as a LinkedIn video part’s firstByte and lastByte, or a chunk of a resumable upload. Left out, the whole file.
object
The first byte, from 0.
The last byte, included.
The file’s name as the service sees it. Defaults to the name it was uploaded with.
Responses
Section titled “Responses”Done
object
The service’s HTTP status. A refusal comes back like any answer, with what the service said in body, rather than as an error.
JSON as parsed, or text. Past 1000000 characters it’s the answer’s start as text and truncated is true: ask for less, such as fewer fields or a smaller page. Secrets in it, such as access tokens and passwords, are hidden.
The answer is a file, such as a PDF: body is its bytes as base64, up to 10 MB. Past that body is null and truncated is true.
Where a redirect points. It isn’t followed.
The service’s answer’s headers, named in lowercase, without cookies: an upload part’s etag, a Link to the next page, a resumable upload’s range.
object
Example generated
{ "status": 1, "contentType": "example", "body": "example", "truncated": true, "binary": true, "location": "example", "headers": { "additionalProperty": "example" }}What was sent isn’t valid (invalid).
object
object
object
Example
{ "error": { "code": "invalid" }}No key, or one that’s unknown, off or expired.
object
object
object
Example
{ "error": { "code": "invalid" }}The key doesn’t have the permission this needs.
object
object
object
Example
{ "error": { "code": "invalid" }}Nothing has that id (not_found).
object
object
object
Example
{ "error": { "code": "invalid" }}A request with the same Idempotency-Key is still running (conflict).
object
object
object
Example
{ "error": { "code": "invalid" }}The Idempotency-Key was used with a different request.
object
object
object
Example
{ "error": { "code": "invalid" }}Over the rate limit; see retry-after.
object
object
object
Example
{ "error": { "code": "invalid" }}