Skip to content

DataAPI SDK english MT.DataAPI Constructor

Taku AMANO edited this page Jul 10, 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 The format to serialize.
options.sessionStore String The session store.
In browser, the cookie is used by default.
options.sessionDomain String The session domain.
When using the cookie, this value is used as cookie domain.
options.sessionPath String The session path.
When using the cookie, this value is used as cookie path.
options.async String If true, use asynchronous XMLHttpRequest.
The default value is the true.
options.cache String If false, add an additional parameter "_" to request to avoid cache.
The default value is the true.
options.disableFormData String If false, 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: true,
  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