API V1 specification (depreciated)

API V1 specification (depreciated)

Ping

Checks if service is up.

Ping Example

Ping Response

{

  • Status: “ok”,
  • Message: “Service is up”

}

Send

Send Electronic Document to recipient.

POST /exchange/send
Header: contentType=”application/json; charset=utf-8″

Send Parameters

{

  • Id: {

    • description: “Sender Username”,
    • type: “integer”,
    • mandatory: true

    },

  • Pass: {

    • description: “Sender Password”,
    • type: “string”,
    • mandatory: true

    },

  • Oib: {

    • description: “Sender Company Id (Oib)”,
    • type: “string”,
    • mandatory: true

    },

  • PJ: {

    • description: “Sender Business Unit (PJ)”,
    • type: “string”,
    • mandatory: false

    },

  • SoftwareId: {

    • description: “Business Software (Erp) Id”,
    • type: “string”,
    • required: true

    },

  • HighImportanceReceive: {

    • description: “…”,
    • type: “bool”,
    • mandatory: false

    },

  • File: {

    • description: “Utf-8 encoded Xml File”,
    • type: “string”,
    • required: true

    }

}

Send Example Request

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”,
  • SoftwareId: “Test-001”,
  • File: “<?xml version=\”1.0\” encoding=\” UTF-8\”?=UTF-8\”?><OutgoingInvoicesData…</OutgoingInvoicesData></?xml>”

}

Send Example Request with IsHighImportantReceive

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”,
  • HighImportanceReceive: “true”,
  • SoftwareId: “Test-001”,
  • File: “<?xml version=\”1.0\” encoding=\”UTF-8\”?><OutgoingInvoicesData>…</OutgoingInvoicesData></?xml>”

}

Send Example response

{

  • id: 615,
  • date: “2014-02-05T19:56:50.5791088+01:00”,
  • error: “”

}

If document is valid, it gets saved, signed and email notification is sent to customer. API returns DocumentId

Example error responses

 

This error indicates that either Username and/or Password are not correct:

 

{

  • Status: “error”,
  • Message: “Korisničko ime i lozinka nisu ispravni\r\n”

}

 

This error indicates that a user doesn’t have sufficient privileges to send eInvoice:

 

{

  • Status: “error”,
  • Message: “Korisnik: \”1808\” nema registrirana prava nad tvrtkom: 35465465468\r\n”

}

 

This error indicates that there is an error with SoftwareId parameter:

 

{

  • SoftwareId: {

    • Value: “”,
    • Messages: [

      • “SoftwareId: \”eRa-001\” nije registriran.”

      ]

    }

}

 

All of this errors should be parsed in order for user to be able to read the error description.

 

Query

Query document status

Status description

10 In preparation – Document is successfully uploaded, but pending validation and sending
20 In validation – Document is successfully uploaded, pending recipient company data validation
30 Sent – Document is successfully uploaded, digitally signed and time stamped. Notification email is sent to customer.
40 Delivered – Customer accepted and downloaded digital invoice
45 Canceled – Customer didn’t accept invoice, so digital invoicing process is canceled. Customer can no longer download document.
50 Unsuccessful – Customer did not accept (download) invoice in 5 days – from this point usual flow is to resend document

Query Single

POST /exchange/getstatus/DocumentId
Header: contentType=”application/json; charset=utf-8″

Query Single Parameters

{

  • Id: {

    • description: “Sender Username”,
    • type: “integer”,
    • mandatory: true

    },

  • Pass: {

    • description: “Sender Password”,
    • type: “string”,
    • mandatory: true

    },

  • Oib: {

    • description: “Sender Company Id (Oib)”,
    • type: “string”,
    • mandatory: true

    },

  • PJ: {

    • description: “Sender Business Unit (PJ)”,
    • type: “string”,
    • mandatory: false

    }

}

Query Single Example

POST /exchange/getstatus/189919
Header: contentType=”application/json; charset=utf-8″

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”

}

Query Single Example Response


Query Inbox

POST /exchange/getstatus
Header: contentType=”application/json; charset=utf-8″

Query Inbox Parameters

{

  • Id: {

    • description: “Sender Username”,
    • type: “integer”,
    • mandatory: true

    },

  • Pass: {

    • description: “Sender Password”,
    • type: “string”,
    • mandatory: true

    },

  • Oib: {

    • description: “Sender Company Id (Oib)”,
    • type: “string”,
    • mandatory: true

    },

  • PJ: {

    • description: “Sender Business Unit (PJ)”,
    • type: “string”,
    • mandatory: false

    },

  • Container: {

    • value: “inbox”,
    • type: “string”,
    • mandatory: true

    },

  • StartDate: {

    • description: “YYYY-MM-DDThh:mm:ss”,
    • type: “ISO datetime”,
    • mandatory: true

    },

  • EndDate: {

    • description: “YYYY-MM-DDThh:mm:ss”,
    • type: “ISO datetime”,
    • mandatory: true

    }

}

Query Inbox Example

POST /exchange/getstatus
Header: contentType=”application/json; charset=utf-8″

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”,
  • Container: “inbox”,
  • StartDate: “2014-09-01T00:00:00”,
  • EndDate: “2014-10-01T00:00:00”

}

Query Inbox Example response


Query Outbox

POST /exchange/getstatus
Header: contentType=”application/json; charset=utf-8″

Query Outbox Parameters

{

  • Id: {

    • description: “Sender Username”,
    • type: “integer”,
    • mandatory: true

    },

  • Pass: {

    • description: “Sender Password”,
    • type: “string”,
    • mandatory: true

    },

  • Oib: {

    • description: “Sender Company Id (Oib)”,
    • type: “string”,
    • mandatory: true

    },

  • PJ: {

    • description: “Sender Business Unit (PJ)”,
    • type: “string”,
    • mandatory: false

    },

  • StartDate: {

    • description: “YYYY-MM-DDThh:mm:ss”,
    • type: “ISO datetime”,
    • mandatory: true

    },

  • EndDate: {

    • description: “YYYY-MM-DDThh:mm:ss”,
    • type: “ISO datetime”,
    • mandatory: true

    }

}

Query Outbox Example

POST /exchange/getstatus
Header: contentType=”application/json; charset=utf-8″

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”,
  • StartDate: “2014-09-01T00:00:00”,
  • EndDate: “2014-10-01T00:00:00”

}

Query Outbox Example response


Receive

Receive method is used for downloading documents. Both sent and incoming, eg. Inbox and Outbox documents.

Receive Document

POST /exchange/receive/DocumentId
Header: contentType=”application/json; charset=utf-8″

Receive Parameters

{

  • Id: {

    • description: “Receiver Username”,
    • type: “integer”,
    • mandatory: true

    },

  • Pass: {

    • description: “Receiver Password”,
    • type: “string”,
    • mandatory: true

    },

  • Oib: {

    • description: “Receiver Company Id (Oib)”,
    • type: “string”,
    • mandatory: true

    },

  • PJ: {

    • description: “Receiver GLN Code / Moj-eRačun Subject ID / Business Unit (PJ)”,
    • type: “string”,
    • mandatory: false

    },

  • SoftwareId: {

    • description: “Receiver software Id”,
    • type: “string”,
    • mandatory: true

    }

}

Receive Document Example

Following examples show how to POST a receive request using all possible values for CompanyBu parameter.

POST /exchange/receive/189919
Header: contentType=”application/json; charset=utf-8″

Example with no Business Unit:

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”

}

Example with GLN Code:

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “3855500180014”

}

Example with Moj-eRačun Subject ID:

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: 440165

}

Example with the name of the Business Unit:

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “Prodavaonica 1”

}

Receive Document Response Document

Receive Document Respnse contains XML document containing electronic Invoice.


Error responses for this method are the same as the error responses for the send method.

NotifyImport

Notify import method is used for sending an information that an invoice is imported into an ERP solution, to the Moj-eRačun service.

NotifyImport

POST /exchange/notifyimport/DocumentId
Header: contentType=”application/json; charset=utf-8″

NotifyImport Parameters

{

  • Id: {

    • description: “Receiver Username”,
    • type: “integer”,
    • mandatory: true

    },

  • Pass: {

    • description: “Receiver Password”,
    • type: “string”,
    • mandatory: true

    },

  • Oib: {

    • description: “Receiver Company Id (Oib)”,
    • type: “string”,
    • mandatory: true

    },

  • PJ: {

    • description: “Receiver GLN Code / Moj-eRačun Subject ID / Business Unit (PJ)”,
    • type: “string”,
    • mandatory: false

    },

  • SoftwareId: {

    • description: “Receiver software Id”,
    • type: “string”,
    • mandatory: true

    }

}

NotifyImport Example

POST /exchange/notifyimport/189919
Header: contentType=”application/json; charset=utf-8″

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”,
  • SoftwareId: “Test-001”

}

Resend

Resend method will resend notification email to customer.

POST /exchange/resend/DocumentId
Header: contentType=”application/json; charset=utf-8″

Query Single Parameters

{

  • Id: {

    • description: “Sender Username”,
    • type: “integer”,
    • mandatory: true

    },

  • Pass: {

    • description: “Sender Password”,
    • type: “string”,
    • mandatory: true

    },

  • Oib: {

    • description: “Sender Company Id (Oib)”,
    • type: “string”,
    • mandatory: true

    },

  • PJ: {

    • description: “Sender Business Unit (PJ)”,
    • type: “string”,
    • mandatory: false

    },

  • SoftwareId: {

    • description: “Business Software (Erp) Id”,
    • type: “string”,
    • required: true

    }

}

Resend Example

POST /exchange/resend/189919
Header: contentType=”application/json; charset=utf-8″

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”,
  • SoftwareId: “Test-001”

}

Cancel

Cancel method will stop Electronic Document delivery.

After cancel method, customer can no longer download document and no further processing can be implemented.

POST /exchange/ispisi/DocumentId
Header: contentType=”application/json; charset=utf-8″

Cancel Parameters

{

  • Id: {

    • description: “Sender Username”,
    • type: “integer”,
    • mandatory: true

    },

  • Pass: {

    • description: “Sender Password”,
    • type: “string”,
    • mandatory: true

    },

  • Oib: {

    • description: “Sender Company Id (Oib)”,
    • type: “string”,
    • mandatory: true

    },

  • PJ: {

    • description: “Sender Business Unit (PJ)”,
    • type: “string”,
    • mandatory: false

    }

}

Cancel Example

POST /exchange/ispisi/189919
Header: contentType=”application/json; charset=utf-8″

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • PJ: “”

}

GetAdditionalDocumentStatuses

This API method retrieves data for all additional document statuses provided by other service providers. This status represents state of document in another system.

GetAdditionalDocumentStatuses Example

POST /exchange/GetAdditionalDocumentStatuses
Header: “content-type:application/json; charset:utf-8”

{

  • Id: 1083,
  • Pass: “test123”,
  • Oib: “99999999927”,
  • SoftwareId: “Test-001”

}

GetAdditionalDocumentStatuses Response Example

[

  • {

    • Id: 100,
    • Description: “Dokument je namijenjen drugom informacijskom posredniku”,
    • DescriptionEn: “Document is intended for another service provider”,
    • Code: null,
    • ServiceProviderId: 1,
    • ServiceProviderName: “[HR] FINA – TDU”

    },

  • {

    • Id: 150,
    • Description: “Dokument je uspješno dostavljen u sustav drugog posrednika”,
    • DescriptionEn: “Document is successfully transfered to another service provider”,
    • Code: null,
    • ServiceProviderId: 1,
    • ServiceProviderName: “[HR] FINA – TDU”

    },

  • {

    • Id: 301,
    • Description: “Dokument se nemože dostaviti, nepoznati subjekt primatelja”,
    • DescriptionEn: “Interchange was undeliverable (incorrect recipient address)”,
    • Code: “UNDELIVERABLE”,
    • ServiceProviderId: 5,
    • ServiceProviderName: “[HR] Editel”

    },

  • {

    • Id: 302,
    • Description: “Slanje dokumenata je zabranjeno”,
    • DescriptionEn: “Interchange sending was prohibited by defined rules)”,
    • Code: “REJECTED”,
    • ServiceProviderId: 5,
    • ServiceProviderName: “[HR] Editel”

    },

  • {

    • Id: 153,
    • Description: “Dokument se obrađuje”,
    • DescriptionEn: “Document is being processed”,
    • Code: “PARSER PROCESSING”,
    • ServiceProviderId: 8,
    • ServiceProviderName: “[HR] OptimIt”

    },

  • {

    • Id: 156,
    • Description: “Dokument ispravno obrađen”,
    • DescriptionEn: “Document processed correctly”,
    • Code: “PARSER OK”,
    • ServiceProviderId: 8,
    • ServiceProviderName: “[HR] OptimIt”

    }

]

Newsletter subscription