Skip to content

DataAPI SDK english MT.DataAPI Constructor

Taku AMANO edited this page Jul 5, 2013 · 8 revisions

Constructor

Parameters

Name Type Required Description
options Object yes Options.
options.clientId String yes Client ID
This value allows alphanumeric, (_)underscore, (-)dash.
options.baseUrl String yes The absolute CGI URL of the DataAPI.
(e.g. http://example.com/mt/mt-data-api.cgi)
options.format String yes The format to serialize.
options.sessionStore String yes The session store.
In browser, the cookie is used by default.
options.sessionDomain String yes The session domain.
When using the cookie, this value is used as cookie domain.
options.sessionPath String yes The session path.
When using the cookie, this value is used as cookie path.
options.async String yes If true, use asynchronous XMLHttpRequest.
The default value is the true.
options.cache String yes If false, add an additional parameter to request to avoid cache.
The default value is the false.
options.disableFormData String yes If true, use FormData when available that.
The default value is the false.

Example

Specify minimal options.

var api = new DataAPI({
  clientId: "your-client-id",
  baseUrl:  "https://your-host/your-mt-api.cgi"
});

Specify all options explicitly.

var api = new DataAPI({
  clientId: "your-client-id",
  baseUrl:  "https://your-host/your-mt-api.cgi",
  format: "json",
  sessionStore: "cookie",
  sessionDomain: "your-host",
  sessionPath: "/client-app/",
  async: true,
  cache: false,
  disableFormData: false
});

Using as a library for Node.js

var api = new DataAPI({
  clientId: "your-client-id",
  baseUrl:  "https://your-host/your-mt-api.cgi",
  sessionStore: "fs",
  sessionPath: "/home/your-login/.mt-data-api.json"
});
Clone this wiki locally