Skip to content

Latest commit

 

History

History
258 lines (190 loc) · 12.2 KB

DocumentsApi.md

File metadata and controls

258 lines (190 loc) · 12.2 KB

AvalaraSdk.EInvoicing.V1.DocumentsApi

All URIs are relative to https://api.sbx.avalara.com/einvoicing

Method HTTP request Description
downloadDocument GET /documents/{documentId}/$download Returns a copy of the document
getDocumentList GET /documents Returns a summary of documents for a date range
getDocumentStatus GET /document/{documentId}/status Checks the status of a document
submitDocument POST /documents Submits a document to Avalara E-Invoicing API

downloadDocument

Blob downloadDocument (string avalaraVersion, string accept, string documentId, string xAvalaraClient)

Returns a copy of the document

When the document is available, use this endpoint to download it as text, XML, or PDF. The output format needs to be specified in the Accept header and it will vary depending on the mandate. If the file has not yet been created, then status code 404 (not found) is returned.

Example

import * as AvalaraSdk from 'avalara-sdk';

const configParams: AvalaraSdk.Runtime.ConfigurationParameters = {
    appName: 'asv-sdk-test-app',
    appVersion: '1.0',
    environment: AvaTaxEnvironment.Sandbox,
    machineName: 'test-machine',
    timeout:3000,
    bearerToken: 'YOUR_BEARER_TOKEN',
    testBasePath: 'https://localhost:3000'
};
const config = new AvalaraSdk.Configuration(configParams);
let client = new AvalaraSdk.Runtime.ApiClient(config);
let api = new AvalaraSdk.EInvoicing.V1.UserApi(client);
const result = await api.createUser();

Parameters

Name Type Description Notes
avalaraVersion string The HTTP Header meant to specify the version of the API intended to be used [default to undefined]
accept string This header indicates the MIME type of the document [default to undefined]
documentId string The unique ID for this document that was returned in the POST /einvoicing/document response body [default to undefined]
xAvalaraClient string You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a "Fingerprint" [optional] [default to undefined]

Return type

Blob

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/pdf, application/xml, application/json

HTTP response details

Status code Description Response headers
200 OK * Content-type -
401 Unauthorized -
403 Forbidden -
404 A document for the specified ID was not found. -
406 Unsupported document format was requested in the Accept header -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDocumentList

DocumentListResponse getDocumentList (string avalaraVersion, string xAvalaraClient, Date startDate, Date endDate, string flow, string $count, string $countOnly, string $filter, number $top, string $skip)

Returns a summary of documents for a date range

Get a list of documents on the Avalara E-Invoicing platform that have a processing date within the specified date range.

Example

import * as AvalaraSdk from 'avalara-sdk';

const configParams: AvalaraSdk.Runtime.ConfigurationParameters = {
    appName: 'asv-sdk-test-app',
    appVersion: '1.0',
    environment: AvaTaxEnvironment.Sandbox,
    machineName: 'test-machine',
    timeout:3000,
    bearerToken: 'YOUR_BEARER_TOKEN',
    testBasePath: 'https://localhost:3000'
};
const config = new AvalaraSdk.Configuration(configParams);
let client = new AvalaraSdk.Runtime.ApiClient(config);
let api = new AvalaraSdk.EInvoicing.V1.UserApi(client);
const result = await api.createUser();

Parameters

Name Type Description Notes
avalaraVersion string The HTTP Header meant to specify the version of the API intended to be used [default to undefined]
xAvalaraClient string You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a "Fingerprint" [optional] [default to undefined]
startDate Date Start date of documents to return. This defaults to the previous month. [optional] [default to undefined]
endDate Date End date of documents to return. This defaults to the current date. [optional] [default to undefined]
flow string Optionally filter by document direction, where issued = `out` and received = `in` [optional] [default to undefined]
$count string When set to true, the count of the collection is also returned in the response body [optional] [default to undefined]
$countOnly string When set to true, only the count of the collection is returned [optional] [default to undefined]
$filter string Filter by field name and value. This filter only supports <code>eq</code> . Refer to https://developer.avalara.com/avatax/filtering-in-rest/ for more information on filtering. Filtering will be done over the provided startDate and endDate. If no startDate or endDate is provided, defaults will be assumed. [optional] [default to undefined]
$top number If nonzero, return no more than this number of results. Used with <code>$skip</code> to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 200 records. [optional] [default to undefined]
$skip string If nonzero, skip this number of results before returning data. Used with <code>$top</code> to provide pagination for large datasets. [optional] [default to undefined]

Return type

DocumentListResponse

Authorization

Bearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDocumentStatus

DocumentStatusResponse getDocumentStatus (string avalaraVersion, string documentId, string xAvalaraClient)

Checks the status of a document

Using the unique ID from POST /einvoicing/documents response body, request the current status of a document.

Example

import * as AvalaraSdk from 'avalara-sdk';

const configParams: AvalaraSdk.Runtime.ConfigurationParameters = {
    appName: 'asv-sdk-test-app',
    appVersion: '1.0',
    environment: AvaTaxEnvironment.Sandbox,
    machineName: 'test-machine',
    timeout:3000,
    bearerToken: 'YOUR_BEARER_TOKEN',
    testBasePath: 'https://localhost:3000'
};
const config = new AvalaraSdk.Configuration(configParams);
let client = new AvalaraSdk.Runtime.ApiClient(config);
let api = new AvalaraSdk.EInvoicing.V1.UserApi(client);
const result = await api.createUser();

Parameters

Name Type Description Notes
avalaraVersion string The HTTP Header meant to specify the version of the API intended to be used [default to undefined]
documentId string The unique ID for this document that was returned in the POST /einvoicing/documents response body [default to undefined]
xAvalaraClient string You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a &quot;Fingerprint&quot; [optional] [default to undefined]

Return type

DocumentStatusResponse

Authorization

Bearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 A document for the specified ID was not found. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

submitDocument

DocumentSubmitResponse submitDocument (string avalaraVersion, SubmitDocumentMetadata metadata, SubmitDocumentData data, string xAvalaraClient)

Submits a document to Avalara E-Invoicing API

For both e-invoices and credit notes, when a document is sent to this endpoint, it generates an invoice or credit note in the required format as mandated by the specified country. Additionally, it initiates the workflow to transmit the generated document to the relevant tax authority, if necessary.

The response from the endpoint contains a unique document ID, which can be used to request the status of the document and verify if it was successfully accepted at the destination.

Furthermore, the unique ID enables the download of a copy of the e-invoice or credit note for reference purposes.

Example

import * as AvalaraSdk from 'avalara-sdk';

const configParams: AvalaraSdk.Runtime.ConfigurationParameters = {
    appName: 'asv-sdk-test-app',
    appVersion: '1.0',
    environment: AvaTaxEnvironment.Sandbox,
    machineName: 'test-machine',
    timeout:3000,
    bearerToken: 'YOUR_BEARER_TOKEN',
    testBasePath: 'https://localhost:3000'
};
const config = new AvalaraSdk.Configuration(configParams);
let client = new AvalaraSdk.Runtime.ApiClient(config);
let api = new AvalaraSdk.EInvoicing.V1.UserApi(client);
const result = await api.createUser();

Parameters

Name Type Description Notes
avalaraVersion string The HTTP Header meant to specify the version of the API intended to be used [default to undefined]
metadata SubmitDocumentMetadata [default to undefined]
data SubmitDocumentData [default to undefined]
xAvalaraClient string You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a &quot;Fingerprint&quot; [optional] [default to undefined]

Return type

DocumentSubmitResponse

Authorization

Bearer

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json, text/xml

HTTP response details

Status code Description Response headers
201 Created -
400 Bad request -
401 Unauthorized -
403 Forbidden -

[Back to top] [Back to API list] [Back to Model list] [Back to README]