Skip to content

Latest commit

 

History

History
133 lines (94 loc) · 4.45 KB

README.md

File metadata and controls

133 lines (94 loc) · 4.45 KB

Dyspatch Javascript API Client

Introduction

The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our Implementation Guide for more details on how to implement Dyspatch.

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 2018.08
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

For more information, please visit https://docs.dyspatch.io

Installation

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install dyspatch-client --save

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var DyspatchClient = require('dyspatch-client');

var defaultClient = DyspatchClient.ApiClient.instance;

// Configure API key authorization: Bearer
var Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = "DYSPATCH_API_KEY"
Bearer.apiKeyPrefix['Authorization'] = "Bearer"

var api = new DyspatchClient.LocalizationsApi()

var localizationId = "loc_12345abcdef"; // {String} A localization ID

var accept = "application/vnd.dyspatch.2018.08+json"; // {String} A version of the API that should be used for the request. For example, to use version \"2018.08\", set the value to \"application/vnd.dyspatch.2018.08+json\"


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.localizationsLocalizationIdGet(localizationId, accept, callback);

Documentation for API Endpoints

All URIs are relative to https://api.dyspatch.io

Class Method HTTP request Description
DyspatchClient.LocalizationsApi localizationsLocalizationIdGet GET /localizations/{localizationId} Get Localization Object by ID
DyspatchClient.TemplatesApi templatesGet GET /templates List Templates
DyspatchClient.TemplatesApi templatesTemplateIdGet GET /templates/{templateId} Get Template by ID

Documentation for Models

Documentation for Authorization

As in the example below, make sure to add 'Bearer' to the Authorization field.

// Configure API key authorization: Bearer
var Bearer = defaultClient.authentications['Bearer'];
Bearer.apiKey = "DYSPATCH_API_KEY"
Bearer.apiKeyPrefix['Authorization'] = "Bearer"

Bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

[email protected]