Get documents and check their status in the API

Get documents and check their status in the API
English

Changes in the document flow for incoming documents can be tracked using a set of events that are returned after calling the «СБИС.СписокИзменений» function.

For example, when an incoming document is received by the server online.saby.ru the «Receive» event was generated. You need to upload all incoming attachments (primary and service) and save to each attachment all e-signatures associated with this event.

  1. Get a list of changed documents for which document flow events occurred in Saby. You can do this using the command «СБИС.СписокИзменений».
  2. If an event is received:
    • not for an incoming or outgoing document «Документ.Направление»≠«Входящий»/«Исходящий» («Document.Direction»≠«Incoming»/«Outgoing») — skip it;
    • with notice about the deletion of the document by the opposite side «Документ.Событие.Название»=«Уведомление об удалении на стороне отправителя» («Document.Event.Name»=«Notification of deletion on the sender's side») — stop document flow and mark the document in your system as deleted;
    • with request for cancellation «Документ.Событие.Название»=«Получение соглашения об аннулировании» («Document.Event.Name»=«Getting a cancellation agreement») — provide a response option in your system. To do this, add to the system the ability to request the responsible person for the document to confirm or reject the cancellation;
    • with the value of the «Документ.Событие.Название» («Document.Event.Name») is different from «Получение» («Getting») - skip it.
  3. Check the document versioning support on your system (several versions).
  4. Support several versions
    Support several versions
    Does not support several versions
    Does not support several versions
    • Determine whether there are previous versions of the document. The search in your information system is performed by the «Документ.Идентификатор» («Document.ID») field;
    • If you find any revisions, mark them as outdated. If necessary, synchronize the document revision states in your information system and with the site online.saby.ru. To do this, use the command «СБИС.ПрочитатьДокумент» with addressing by field «Документ.Редакция.Идентификатор» («Document.Edition.ID»).
    • Register the new version of the document in the «Документ.Редакция.Идентификатор» («Document.Edition.ID»).
    • Determine whether the document is in your information system. The search in your system is performed by the «Документ.Идентификатор» («Document.ID») field. If you have a document, move it to the archive;
    • If the value of the field:
      • «Документ.Редакция.Актуален»=«Нет» («Document.Edition.Current»=«No») — the revision is not up-to-date. Skip processing;
      • «Документ.Редакция.Актуален»=«Да» («Document.Edition.Current»=«Yes») — the revision is up-to-date. Register the document as a new incoming one.
  5. Upload the attachments of the incoming document to your information system:
    • Get and save the contents of your incoming attachments to a local archive «Документ.Событие.Вложение.Направление»=«Входящий» («Document.Event.Attachment.Direction»=«Incoming»s) that are associated with the event.
      • primary — «Документ.Событие.Вложение.Служебный»=«Нет» («Document.Event.Attachment.Service»=«No»);
      • service — «Документ.Событие.Вложение.Служебный»=«Да» («Document.Event.Attachment.Service»=«Yes»). HTTP GET request at the URL specified in the «Документ.Событие.Вложение.Подпись.Файл.Ссылка» («Document.Event.Attachment.File.Link») field.
    • Get and save to the local archive the contents of the e-signature associated with the event attachments:
      • as incoming attachments «Документ.Событие.Вложение.Направление»=«Входящий» («Document.Event.Attachment.Direction»=«Incoming»);
      • as the attachments for which there are incoming signatures «Документ.Событие.Вложение.Файл.Ссылка» («Document.Event.Attachment.File.Link») — empty, «Документ.Событие.Вложение.Подпись.Файл.Ссылка» («Document.Event.Attachment.Signature.File.Link») — not empty.

Comment

One or more e-signatures can be associated with an event «Документ.Вложение.Ссылка» («Document.Attachment.Link») — empty, and «Документ.Вложение.Подпись.Ссылка» («Document.Attachment.Signature.Link») — not empty. This means, for example, sending a signature under the primary document when verifying it.

To get the contents of an attachment, run an HTTP GET request at the URL specified in the field «Документ.Событие.Вложение.Ссылка» («Document.Event.Attachment.Link»).

To get the e-signature content, run an HTTP GET request at the URL specified in the field «Документ.Событие.Вложение.Подпись.Ссылка» («Document.Event.Attachment.Signature.Link»).

«Документ.Состояние» («Document.State») describes the state for the revision for which the event was registered. This should be taken into account when processing the event.

The described algorithms are approximate and may not cover all possible actions that are necessary for the full integration of your information system.

License

The «Exchange with partners» and «Implementation of EDI» tariffs of «Electronic Document Flow» service.

Нашли неточность? Выделите текст с ошибкой и нажмите ctrl + enter.