Send information about a Closing document from an ERP system

The Send information about a Closing document from an ERP system method is used for sending information about a Closing document of an Account of the current Reseller or any of its downstream Resellers from a third-party ERP system to the platform.

An API token of a Manager is required for authorization. To get an API token via the Operator Control Panel, see Viewing and updating manager's information

The Manager's API token specified in an API request determines the current Reseller and downstream Resellers accessible within a method.

POST {base_url}/api/v3/resellers/{reseller_id}/accounts/{account_id}/external_invoices

Arguments

Name

Parameter Type

Data type

Required/Optional

Description

X-Api-TokenheaderstringRequiredAPI token of a Manager that performs the operation (see Viewing and updating manager's information)
Content-TypeheaderstringRequiredMedia type of the request. Specify the following: application/vnd.api+json
AcceptheaderstringRequired

Supported media types of the answer. Specify the following: application/vnd.api+json

base_urlpathstringRequiredActivePlatform URL
reseller_idpathnumberRequiredID of the current Reseller or any of its downstream Resellers (see Viewing and updating reseller general information)
account_idpathnumberRequiredAccount ID
keyformstringRequiredClosing document GUID in a third-party ERP system
typeformstringRequired

Closing document type:

  • invoice — Invoice
  • invoice_vat — Invoice (vat)
  • act — Act of acceptance
nameformstringRequiredClosing document name
start_dateformstringRequiredStart date of the Billing period for which the Closing document is issued
end_dateformstringRequiredEnd date of the Billing period for which the Closing document is issued
fileformstringRequired

Closing document in the base64 encoding including its MIME-type (see Media type). The following file types are supported:

  • .DOC
  • .PDF
  • .XLSX

The maximum file size of a Closing document is defined by the settings of the given installation of the platform. To change the limit, please contact the support team.

Data format:

data:<MIME-type>;base64,'base64 file contents'

Response model

Name

Data type

Description

dataobjectResponse data


id

string

Closing document ID in the platform

typestringData type

attributesobjectClosing document information


created_at

string

Date and time of Closing document creation


updated_at

string

Data and time of Closing document last update


keystringClosing document GUID in a third-party ERP system


namestringClosing document name


start_datestringStart date of the Billing period for which the Closing document is issued


end_datestringEnd date of the Billing period for which the Closing document is issued


filestringClosing document in the base64 encoding


typestring

Closing document type:

  • invoice — Invoice
  • invoice_vat — Invoice (VAT)
  • act — Act of acceptance

Errors

The method responds with the 500 Internal Server Error status if the file attribute was specified incorrectly:

  • Missing a coma before the file contents.
  • The file extension cannot be identified based on the file contents and the specified content-type.

Request example

POST /api/v3/resellers/1/accounts/505/external_invoices
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+jsonson
{
"key": "0493e78a-e8ef-11e9-81b4-2a2ae2dbcce4",
"type": "invoice",
"name": "New invoice",
"start_date": "2019-09-01",
"end_date": "2019-10-01",
"file": "data:application/pdf;base64,'SSBob2xkIHRoZSBwb3NpdGlvbiBvZiBhIHFhIGVuZ2luZWVyLiBRQSBlbmdpbmVlciByZXNwb25zaWJpbGl0aWVzIGluY2x1ZGUgZGVzaWduaW5nIGFuZCBpbXBsZW1lbnRpbmcgdGVzdHMsIGRlYnVnZ2luZyBhbmQgZGVmaW5pbmcgY29ycmVjdGl2ZSBhY3Rpb25zLiBJIGFsc28gcmV2aWV3IHN5c3RlbSByZXF1aXJlbWVudHMgYW5kIHRyYWNrIHF1YWxpdHkgYXNzdXJhbmNlIG1ldHJpY3MgKGUuZy4gZGVmZWN0IGRlbnNpdGllcyBhbmQgb3BlbiBkZWZlY3QgY291bnRzLikgVGhlIFFBIHRlY2huaWNpYW4gcm9sZSBwbGF5cyBhbiBpbXBvcnRhbnQgcGFydCBpbiBvdXIgY29tcGFueeKAmXMgcHJvZHVjdCBkZXZlbG9wbWVudCBwcm9jZXNzLg=='"
}

Response example

{
    "data": {
        "id": "11",
        "type": "external_invoices",
        "attributes": {
            "created_at": "2019-10-18T13:45:38.333297+0300",
            "updated_at": "2019-10-18T13:45:38.333297+0300",
            "key": "0493e78a-e8ef-11e9-81b4-2a2ae2dbcce4",
            "name": "New invoice",
            "start_date": "2019-10-01",
            "end_date": "2019-10-01",
            "file": "data:application/pdf;base64,SSBob2xkIHRoZSBwb3NpdGlvbiBvZiBhIHFhIGVuZ2luZWVyLiBRQSBlbmdp\nbmVlciByZXNwb25zaWJpbGl0aWVzIGluY2x1ZGUgZGVzaWduaW5nIGFuZCBp\nbXBsZW1lbnRpbmcgdGVzdHMsIGRlYnVnZ2luZyBhbmQgZGVmaW5pbmcgY29y\ncmVjdGl2ZSBhY3Rpb25zLiBJIGFsc28gcmV2aWV3IHN5c3RlbSByZXF1aXJl\nbWVudHMgYW5kIHRyYWNrIHF1YWxpdHkgYXNzdXJhbmNlIG1ldHJpY3MgKGUu\nZy4gZGVmZWN0IGRlbnNpdGllcyBhbmQgb3BlbiBkZWZlY3QgY291bnRzLikg\nVGhlIFFBIHRlY2huaWNpYW4gcm9sZSBwbGF5cyBhbiBpbXBvcnRhbnQgcGFy\ndCBpbiBvdXIgY29tcGFueeKAmXMgcHJvZHVjdCBkZXZlbG9wbWVudCBwcm9j\nZXNzLg==\n",
            "type": "invoice"
        }
    }
}