Generic API Pattern
Each API method is composed of a Request and Response. Both are documented using TypeScript notation for ease of understanding.
export type ResponseType = RequestType;
export interface DmRequest {
requestType: RequestType;
}
export interface DmResponse {
responseType: ResponseType;
serverVersion: Version;
// Response codes to indicate the result
responseCode: ResponseCode;
// If there is an error, a message is provided.
responseMessage?: string;
// If there are validation error messages, they are included here.
errors?: ValidationError[];
}
export interface DmAlgRequest extends DmRequest {
apiInstanceId: string;
}
For fetching data, the request contains criteria of what to fetch and the response contains the data requested. For updates, the request contains a list of items to be updated and fields to update for each item. Creating new items is similar to updates except the item ids are not specified in the request. The response indicates the result of the update for each item in the request.
Note: All Date values for the API are to be specified in yyyy-MM-dd'T'HH:mm:ss. SSSXXX. Where XXX is the time zone. Batching Requests Multiple API requests in this document can be batched into one HTTPS call. This can be useful to reduce the number of HTTPS calls to increase performance, and to reduce how many times user context info is sent to the server.
Note that each API request in the batch HTTPS call is counted as an API request for billing purposes. Batching improves performance but does not affect price and API usage metering. batchRequest Several requests can be sent as a list to the server in one HTTPS call. The server will then respond with one response which includes all the individual results from each API request in the same order as the request.
export interface BatchRequests {
requests: DmRequest[];
}
export interface BatchResponse {
responses: DmResponse[];
}