API method

getSaleDocuments

Method returns links to sale documents.
Only 250 results can be fetched via request. Please use request filters to fetch other results.

GET
Usage URL
https://b2b.onesto-energy.pl/api/getSaleDocuments.json?key=YOURAPIKEY

Query params

Put these in your URL, e.g. ?id=123.

  • id integer or integer[]

    Internal identifier of sale.
    More than one value can be specified after comma (,) separator.

  • date datetime YYYY-MM-DD HH:MM:SS

    Return all documents created after the modified date. That is highly recommended when you want to update your local database.

  • type integer or integer[]

    Return all documents assigned to sale with type param.
    Check getSales for more information about sale types.
    More than one value can be specified after comma (,) separator.

  • lang string

    Language of result. ISO 2 Letter Language Codes

    Example

    en, pl, cs

Response fields

Fields returned by this method.

  • id integer

    Internal identifier of document.

  • name string

    Document file name

  • langiso2 string

    Document language iso

  • ext string

    File extension

  • size integer

    File size in bytes

  • mime string

    File mime type

  • saleid integer

    Internal identifier of sale

  • saledate datetime YYYY-MM-DD HH:MM:SS

    When sale was created

  • saletype integer

    Type of sale: -1 - Order, 0 - Invoice, 1 - Invoice correction, 2 - Receipt, 3 - Receipt correction, 5 - Advance invoice, 10 - Utilization, 100 - Invoice non-rating, 101 - Temporary invoice

  • payload string

    File bytes
    Example how to save such file (PHP):

    $json = file_get_contents("USAGE_URL_HERE");
    $obj = json_decode($json);
    file_put_contents("{$obj[0]->name}.{$obj[0]->ext}", utf8_decode($obj[0]->payload));

Response JSON
Example URL: https://b2b.onesto-energy.pl/api/getSaleDocuments.json?key=YOURAPIKEY&lang=en&id=112087

Response XML
Example URL: https://b2b.onesto-energy.pl/api/getSaleDocuments.xml?key=YOURAPIKEY&lang=en&id=112087