Skip to content

Latest commit

 

History

History
229 lines (168 loc) · 5.87 KB

DocumentsApi.md

File metadata and controls

229 lines (168 loc) · 5.87 KB

TransferzeroSdk.DocumentsApi

All URIs are relative to https://api-sandbox.transferzero.com/v1

Method HTTP request Description
getDocument GET /documents/{Document ID} Fetching a document
getDocuments GET /documents Getting a list of documents
postDocuments POST /documents Creating a document

getDocument

DocumentResponse getDocument(documentID)

Fetching a document

Returns a single document by the Documents ID

Example

import { DocumentsApi } from 'transferzero-sdk';

// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

let apiInstance = new DocumentsApi(apiClient);

apiInstance.getDocument(documentID).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  if (error.isValidationError) {
    let result = error.getResponseObject();
    console.log(result);
    console.error("WARN: Validation error occurred when calling the endpoint");
  } else {
    console.error("Exception when calling DocumentsApi#getDocument");
    throw error;
  }
});

Parameters

Name Type Description Notes
documentID String ID of the document to get. Example: `/v1/documents/bf9ff782-e182-45ac-abea-5bce83ad6670`

Return type

DocumentResponse

Authorization

You can set the API Key and Secret by passing a config object when creating an ApiClient:

const apiClient = new ApiClient({
  apiKey: '<key>',
  apiSecret: '<secret>',
  basePath: 'https://api-sandbox.transferzero.com/v1'
});

Or by setting the properties on an ApiClient instance:

const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

HTTP request headers

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

getDocuments

DocumentListResponse getDocuments(opts)

Getting a list of documents

Fetches a list of documents.

Example

import { DocumentsApi } from 'transferzero-sdk';

// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

let apiInstance = new DocumentsApi(apiClient);

let opts = { 
  'page': 1 // Number | The page number to request (defaults to 1)
  'per': 10 // Number | The number of results to load per page (defaults to 10)
};
apiInstance.getDocuments(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  if (error.isValidationError) {
    let result = error.getResponseObject();
    console.log(result);
    console.error("WARN: Validation error occurred when calling the endpoint");
  } else {
    console.error("Exception when calling DocumentsApi#getDocuments");
    throw error;
  }
});

Parameters

Name Type Description Notes
page Number The page number to request (defaults to 1) [optional]
per Number The number of results to load per page (defaults to 10) [optional]

Return type

DocumentListResponse

Authorization

You can set the API Key and Secret by passing a config object when creating an ApiClient:

const apiClient = new ApiClient({
  apiKey: '<key>',
  apiSecret: '<secret>',
  basePath: 'https://api-sandbox.transferzero.com/v1'
});

Or by setting the properties on an ApiClient instance:

const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

HTTP request headers

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

postDocuments

DocumentResponse postDocuments(documentRequest)

Creating a document

Creates a new document

Example

import { DocumentsApi } from 'transferzero-sdk';

// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

let apiInstance = new DocumentsApi(apiClient);

apiInstance.postDocuments(documentRequest).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  if (error.isValidationError) {
    let result = error.getResponseObject();
    console.log(result);
    console.error("WARN: Validation error occurred when calling the endpoint");
  } else {
    console.error("Exception when calling DocumentsApi#postDocuments");
    throw error;
  }
});

Parameters

Name Type Description Notes
documentRequest DocumentRequest

Return type

DocumentResponse

Authorization

You can set the API Key and Secret by passing a config object when creating an ApiClient:

const apiClient = new ApiClient({
  apiKey: '<key>',
  apiSecret: '<secret>',
  basePath: 'https://api-sandbox.transferzero.com/v1'
});

Or by setting the properties on an ApiClient instance:

const apiClient = new ApiClient();
apiClient.apiKey = '<key>';
apiClient.apiSecret = '<secret>';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';

HTTP request headers

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