Skip to content

Latest commit

 

History

History
448 lines (306 loc) · 14.7 KB

WebhookApi.md

File metadata and controls

448 lines (306 loc) · 14.7 KB

UltraCartRestApiV2.WebhookApi

All URIs are relative to https://secure.ultracart.com/rest/v2

Method HTTP request Description
deleteWebhook DELETE /webhook/webhooks/{webhookOid} Delete a webhook
deleteWebhookByUrl DELETE /webhook/webhooks Delete a webhook by URL
getWebhookLog GET /webhook/webhooks/{webhookOid}/logs/{requestId} Retrieve an individual log
getWebhookLogSummaries GET /webhook/webhooks/{webhookOid}/logs Retrieve the log summaries
getWebhooks GET /webhook/webhooks Retrieve webhooks
insertWebhook POST /webhook/webhooks Add a webhook
resendEvent POST /webhook/webhooks/{webhookOid}/reflow/{eventName} Resend events to the webhook endpoint.
updateWebhook PUT /webhook/webhooks/{webhookOid} Update a webhook

deleteWebhook

deleteWebhook(webhookOid)

Delete a webhook

Delete a webhook on the UltraCart account.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.WebhookApi();


var webhookOid = 56; // Number | The webhook oid to delete.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deleteWebhook(webhookOid, callback);

Parameters

Name Type Description Notes
webhookOid Number The webhook oid to delete.

Return type

null (empty response body)

Authorization

ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteWebhookByUrl

WebhookResponse deleteWebhookByUrl(webhook)

Delete a webhook by URL

Delete a webhook based upon the URL on the webhook_url matching an existing webhook.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.WebhookApi();


var webhook = new UltraCartRestApiV2.Webhook(); // Webhook | Webhook to delete


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.deleteWebhookByUrl(webhook, callback);

Parameters

Name Type Description Notes
webhook Webhook Webhook to delete

Return type

WebhookResponse

Authorization

ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/json; charset=UTF-8
  • Accept: application/json

getWebhookLog

WebhookLogResponse getWebhookLog(webhookOid, requestId)

Retrieve an individual log

Retrieves an individual log for a webhook given the webhook oid the request id.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.WebhookApi();


var webhookOid = 56; // Number | The webhook oid that owns the log.

var requestId = "requestId_example"; // String | The request id associated with the log to view.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getWebhookLog(webhookOid, requestId, callback);

Parameters

Name Type Description Notes
webhookOid Number The webhook oid that owns the log.
requestId String The request id associated with the log to view.

Return type

WebhookLogResponse

Authorization

ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getWebhookLogSummaries

WebhookLogSummariesResponse getWebhookLogSummaries(webhookOid, opts)

Retrieve the log summaries

Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.WebhookApi();


var webhookOid = 56; // Number | The webhook oid to retrieve log summaries for.

var opts = { 
  '_limit': 100, // Number | The maximum number of records to return on this one API call.
  '_offset': 0, // Number | Pagination of the record set.  Offset is a zero based index.
  '_since': "_since_example" // String | Fetch log summaries that have been delivered since this date/time.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getWebhookLogSummaries(webhookOid, opts, callback);

Parameters

Name Type Description Notes
webhookOid Number The webhook oid to retrieve log summaries for.
_limit Number The maximum number of records to return on this one API call. [optional] [default to 100]
_offset Number Pagination of the record set. Offset is a zero based index. [optional] [default to 0]
_since String Fetch log summaries that have been delivered since this date/time. [optional]

Return type

WebhookLogSummariesResponse

Authorization

ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getWebhooks

WebhooksResponse getWebhooks(opts)

Retrieve webhooks

Retrieves the webhooks associated with this application.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.WebhookApi();


var opts = { 
  '_limit': 100, // Number | The maximum number of records to return on this one API call.
  '_offset': 0, // Number | Pagination of the record set.  Offset is a zero based index.
  '_sort': "_sort_example", // String | The sort order of the webhooks.  See documentation for examples
  '_placeholders': true // Boolean | Whether or not placeholder values should be returned in the result.  Useful for UIs that consume this REST API.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getWebhooks(opts, callback);

Parameters

Name Type Description Notes
_limit Number The maximum number of records to return on this one API call. [optional] [default to 100]
_offset Number Pagination of the record set. Offset is a zero based index. [optional] [default to 0]
_sort String The sort order of the webhooks. See documentation for examples [optional]
_placeholders Boolean Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. [optional]

Return type

WebhooksResponse

Authorization

ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

insertWebhook

WebhookResponse insertWebhook(webhook, opts)

Add a webhook

Adds a new webhook on the account. If you add a new webhook with the authentication_type set to basic, but do not specify the basic_username and basic_password, UltraCart will automatically generate random ones and return them. This allows your application to have simpler logic on the setup of a secure webhook.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.WebhookApi();


var webhook = new UltraCartRestApiV2.Webhook(); // Webhook | Webhook to create

var opts = { 
  '_placeholders': true // Boolean | Whether or not placeholder values should be returned in the result.  Useful for UIs that consume this REST API.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.insertWebhook(webhook, opts, callback);

Parameters

Name Type Description Notes
webhook Webhook Webhook to create
_placeholders Boolean Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. [optional]

Return type

WebhookResponse

Authorization

ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/json; charset=UTF-8
  • Accept: application/json

resendEvent

WebhookSampleRequestResponse resendEvent(webhookOid, eventName)

Resend events to the webhook endpoint.

This method will resend events to the webhook endpoint. This method can be used for example to send all the existing items on an account to a webhook.

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.WebhookApi();


var webhookOid = 56; // Number | The webhook oid that is receiving the reflowed events.

var eventName = "eventName_example"; // String | The event to reflow.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.resendEvent(webhookOid, eventName, callback);

Parameters

Name Type Description Notes
webhookOid Number The webhook oid that is receiving the reflowed events.
eventName String The event to reflow.

Return type

WebhookSampleRequestResponse

Authorization

ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateWebhook

WebhookResponse updateWebhook(webhook, webhookOid, opts)

Update a webhook

Update a webhook on the account

Example

var UltraCartRestApiV2 = require('ultra_cart_rest_api_v2');

// Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
var simpleKey = "109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00";
UltraCartRestApiV2.ApiClient.usingApiKey(simpleKey, false)
var apiInstance = new UltraCartRestApiV2.WebhookApi();


var webhook = new UltraCartRestApiV2.Webhook(); // Webhook | Webhook to update

var webhookOid = 56; // Number | The webhook oid to update.

var opts = { 
  '_placeholders': true // Boolean | Whether or not placeholder values should be returned in the result.  Useful for UIs that consume this REST API.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.updateWebhook(webhook, webhookOid, opts, callback);

Parameters

Name Type Description Notes
webhook Webhook Webhook to update
webhookOid Number The webhook oid to update.
_placeholders Boolean Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. [optional]

Return type

WebhookResponse

Authorization

ultraCartOauth, ultraCartSimpleApiKey

HTTP request headers

  • Content-Type: application/json; charset=UTF-8
  • Accept: application/json