Send closing document from ERP

The Send closing document from ERP 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.

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

Arguments

Name

Parameter Type

Data type

Required/Optional

Description

X-Api-Token

header

string

Required

API token of a manager that performs the operation (see


)

Content-Type

header

string

Required

Media type of the request. Specify the following: application/vnd.api+json

Accept

header

string

Required

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

base_url

path

string

Required

ActivePlatform URL

reseller_id

path

number

Required

ID of the current reseller or any of its downstream resellers (see 


)

account_id

path

number

Required

Account ID

key

form

string

Required

Closing document GUID in a third-party ERP system

type

form

string

Required

Closing document type:

  • invoice — invoice.

  • invoice_vat — invoice (vat).

  • act — act of acceptance.

name

form

string

Required

Closing document name

amount

form

string

Required

Information about the amount and currency of the closing document in a third-party ERP system


total

form

string

Required

The amount of the closing document in a third-party ERP system. The value must have the money format. The value can be less than or equal to 0. Example: 123.45


currency

form

string

Required

The ISO code of the currency of the closing document in a third-party ERP system. Can be specified the code of any currency in the platform (see Get list of currency rates)

start_date

form

string

Required

Start date of the billing period for which the closing document is issued (YYYY-MM-DD)

end_date

form

string

Required

End date of the billing period for which the closing document is issued (YYYY-MM-DD)

file

form

string

Required

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

If no errors are encountered, the method returns information about the closing document (see the response model in Get closing document).

Errors

Status

Error text

Comment

400

Parameter "total" contains an unsupported format 

The value of total must have the money format. Example: 123.45

Parameter "currency" contains an unsupported currency by the reseller

Check the supported currency codes in

Get list of currency rates

422

Unprocessable entity

  • A required parameter is missing: key, name, start_date, end_date.

  • Incorrect parameter format: start_date, end_date, key.

  • 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.

  • The value of the type parameter is not specified or is not supported.

Request example

XML
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
JSON
{
    "key": "0493e78a-e8ef-11e9-81b4-2a2ae2dbcce4",
    "type": "invoice",
    "name": "New invoice",
    "amount": {
        "total": "123.45",
        "currency": "EUR"
    },
    "start_date": "2019-09-01",
    "end_date": "2019-10-01",
    "file": "data:application/pdf;base64,'SSBob2xkIHRoZSBwb3NpdGlvbiBvZiBhIHFhIGVuZ2luZWVyLiBRQSBlbmdpbmVlciByZXNwb25zaWJpbGl0aWVzIGluY2x1ZGUgZGVzaWduaW5nIGFuZCBpbXBsZW1lbnRpbmcgdGVzdHMsIGRlYnVnZ2luZyBhbmQgZGVmaW5pbmcgY29ycmVjdGl2ZSBhY3Rpb25zLiBJIGFsc28gcmV2aWV3IHN5c3RlbSByZXF1aXJlbWVudHMgYW5kIHRyYWNrIHF1YWxpdHkgYXNzdXJhbmNlIG1ldHJpY3MgKGUuZy4gZGVmZWN0IGRlbnNpdGllcyBhbmQgb3BlbiBkZWZlY3QgY291bnRzLikgVGhlIFFBIHRlY2huaWNpYW4gcm9sZSBwbGF5cyBhbiBpbXBvcnRhbnQgcGFydCBpbiBvdXIgY29tcGFueeKAmXMgcHJvZHVjdCBkZXZlbG9wbWVudCBwcm9jZXNzLg=='"
}

Response example

JSON
{
    "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",
            "amount": {
                "total": "123.45",
                "currency": "EUR"
            },
            "start_date": "2019-09-01",
            "end_date": "2019-10-01",
            "file": "data:application/pdf;base64,SSBob2xkIHRoZSBwb3NpdGlvbiBvZiBhIHFhIGVuZ2luZWVyLiBRQSBlbmdp\nbmVlciByZXNwb25zaWJpbGl0aWVzIGluY2x1ZGUgZGVzaWduaW5nIGFuZCBp\nbXBsZW1lbnRpbmcgdGVzdHMsIGRlYnVnZ2luZyBhbmQgZGVmaW5pbmcgY29y\ncmVjdGl2ZSBhY3Rpb25zLiBJIGFsc28gcmV2aWV3IHN5c3RlbSByZXF1aXJl\nbWVudHMgYW5kIHRyYWNrIHF1YWxpdHkgYXNzdXJhbmNlIG1ldHJpY3MgKGUu\nZy4gZGVmZWN0IGRlbnNpdGllcyBhbmQgb3BlbiBkZWZlY3QgY291bnRzLikg\nVGhlIFFBIHRlY2huaWNpYW4gcm9sZSBwbGF5cyBhbiBpbXBvcnRhbnQgcGFy\ndCBpbiBvdXIgY29tcGFueeKAmXMgcHJvZHVjdCBkZXZlbG9wbWVudCBwcm9j\nZXNzLg==\n",
            "type": "invoice"
        }
    }
}