Nexus API ########### HTTP API ======== Authentication -------------- Currently every request made to nexus must be authenticated using the *HTTP basic auth* mechanism. Other authentication mechanisms (e.g. OpenID Connect) might be supported in the future. Users Management ---------------- .. http:get:: /user Get information about the current user (based on the authentication information in this request). **Response:** .. ts:def:: GetUserResponse interface UserResponse { // User name username: string; // Is it a superuser? superuser: boolean; } .. http:post:: /users Create a new user. Only the super-user can call this API. **Request:** The body is a `User` object. **Response:** :status 409 Conflict: Username is not available. **Details:** .. ts:def:: User interface User { // User name username: string; // Initial password password: string; } Bank Account Management ----------------------- .. http:get:: /bank-accounts **Response:** A list of `BankAccount` objects that belong to the requester. .. ts:def:: BankAccount interface BankAccount { // mnemonic name identifying this bank account. account: string; // IBAN iban: string; // BIC bic: string; // Legal subject owning the account. holder: string; } .. http:post:: /bank-accounts/prepared-payments/submit Ask nexus to submit one prepare payment at the bank. **Request:** .. ts:def:: SubmitPayment interface SubmitPayment { // Unique identifier of the (previously) prepared payment // to submit at the bank. uuid: string; // Specify the bank transport to use for the submission. transport?: Transport; } .. ts:def:: Transport interface Transport { // Transport type: 'ebics', 'local', 'fints' (forthcoming). // It must match one of the types actually implemented by // nexus. type: string; // A mnemonic identifier given by the user to one particular // transport instance. name: string; } :status 404 Not Found: the unique identifier **or** the bank transport could not be found in the system .. http:get:: /bank-accounts//prepared-payments/$uuid Ask the status of payment ``$uuid``. **Response:** .. ts:def:: PaymentStatus interface PaymentStatus { // Payment unique identifier uuid: string; // True for submitted payments submitted: boolean; // Creditor IBAN creditorIban: string; // Creditor BIC creditorBic: string; // Creditor legal name creditorName: string; // Amount amount: string; // Subject subject: string; // Date of submission (in dashed form YYYY-MM-DD) submissionDate: string; // Date of preparation (in dashed form YYYY-MM-DD) preparationDate: string; } .. http:post:: /bank-accounts//prepared-payments Ask nexus to prepare instructions for a new payment. Note that ``my-acct`` is the bank account that will be **debited** after this operation. **Request:** .. ts:def:: PreparedPaymentRequest interface PreparedPaymentRequest { // IBAN that will receive the payment. iban: string; // BIC hosting the IBAN. bic: string; // Legal subject that will receive the payment. name: string; // payment subject. subject: string; // amount, in the format CURRENCY:XX.YY amount: string } **Response:** .. ts:def:: PreparedPaymentResponse interface PreparedPaymentResponse { // Opaque identifier to be communicated when // the user wants to submit the payment to the // bank. uuid: string; } .. http:post:: /bank-accounts/collected-transactions Nexus will download bank transactions from the given transport. **Request:** .. ts:def:: CollectedTransaction interface CollectedTransaction { // Optional field to specify the bank transport to // use for such operation. bankTransport?: Transport; // dashed date (YYYY-MM-DD) of the earliest payment // in the result. Optional, defaults to "earliest // possible" date. start: string; // dashed date (YYYY-MM-DD) of the earliest payment // in the result. Optional, defaults to "latest // possible" date. end: string; } .. http:get:: /bank-accounts//collected-transactions Shows which transactions are stored locally at nexus. **Query parameters:** * **start** start (dashed YYYY-MM-DD) date of desired payments. Optional, defaults to "earliest possible" date * **end** end (dashed YYYY-MM-DD) date of desired payments. Optional, defaults to "earliest possible" date **Response:** A list of `Transaction` objects. .. ts:def:: Transaction interface Transaction { // local bank account involved in the transaction. account: string; // counterpart IBAN counterpartIban: string; // counterpart BIC counterpartBic: string; // counterpart holder name counterpartName: string; // amount, in the format [-]CURRENCY:XX.YY, // where the minus sign as prefix indicates // a debit for the user's bank account. amount: string; // Dashed date YYYY-MM(01-12)-DD(01-31) of the transaction. date: string; // Payment subject. subject: string; } Bank Transports --------------- Bank transports connect the local LibEuFin bank account to the real bank. .. http:post:: /bank-transports Activate a new bank transport for the requesting user. **Request:** .. ts:def:: BankTransport interface BankTransport { transport: Transport; // Restore a previous transport. Take precedence // over the 'new' field. backup?: TransportBackup; // Data to create a fresh bank transport without // restoring any backup. data?: TransportNew; } .. ts:def:: TransportNew interface TransportNew { // This type is strictly dependent on // the transport being created. For Ebics, // it will contain the required fields (as strings): // 'ebicsURL', 'userID', 'partnerID', 'hostID', and // the optional 'systemID'. // Other transport types, like 'local' (used for testing // purposes skipping any interaction with the bank service) // and 'fints' are all work in progress! } .. ts:def:: TransportBackup interface TransportBackup { // The information needed in this type depend entirely // on which transport is being restored. } **Response:** :status 409 Conflict: The ``name`` field exists already for the requesting user. .. http:post:: /bank-transports/sendMSG. Perform the ``MSG`` operation offered by ``transport-name`` **without** affecting the nexus database. **Request:** A `Transport` object. **Response:** :status 404 Not Found: ``transport-name`` doesn't exist for the requesting user. .. http:post:: /bank-transports//syncMSG. Some transports **do** have operations that aren't semantically related to a bank account but need to be stored locally at the nexus. One typical example is the downloading of the bank's keys vie the EBICS transport. This API lets the user perform the ``MSG`` operation that should result in new data being stored locally at the nexus. **Response:** :status 404 Not Found: ``transport-name`` doesn't exist for the requesting user.