How to access, preview, or create a document from another application via URL?

Tabla de contenidos

To facilitate integration tasks, Athento offers the ability to use URLs (which can be linked or embedded in e-frames) to preview documents, create them, or consult them.

With these URLs, it is possible to access a document by indicating values of its metadata so that Athento can locate it and present it to the user.

 

Preview the main file

To do so, the following pattern will be used in the URL:

https://app.athento.com/file/view/_/?filter=<filtro>

where,

  • <filtro>, is the set of fields (with their values) that Athento will use to locate the document that contains those values in the indicated fields. 

    • Eg: metadata.mymetadata=123456&metadata.myothermetadata=5678
      NOTE: the filter value must be encrypted according to Athento’s policy.

It is important to note that, since there is a possibility that several documents match the indicated filter, the fields used must be configured as key fields. If it happens that several documents match the filter, Athento will display the first document found from the filter result.

NOTE: Key fields are those whose value will be unique in each Athento document.

 

Create documents

In addition to being able to only filter to view a document by its fields, this functionality offers different URL parameters that allow you to create a new document if it is not found in the filtering, and/or view it in Carousel and List mode.

For the case of creating the document if it is not found with the fields indicated in the filter, the create_if parameter will be used:

https://app.athento.com/file/view/_/?filter=<filtro>&create_if=true

where after filtering, if Athento does not locate the document, it will create it and access it with the fields. The document will be created in the user’s default space and on the default form type of that same space.

If we want to indicate in which space and using which form type to use for creation in case the filter does not locate any document, we would have:

https://app.athento.com/file/view/_/?filter=<filtro>&create_if=true&serie=<serie>&type=<tipo>

where,

  • <serie>, is the name (or uuid) of the destination space where the document is intended to be stored in case it is not located by the filter.
  • <tipo>, is the name of the form type that will be used to create the new document in case it is not located by the filter.

 

Preview related documents

In addition to viewing and/or creating the document via the field filter, Athento can preview related documents. This is very useful for integration cases where the client needs to preview the related document(s) by embedding this URL.

To preview a document using the filter, we will use the display parameter, like this:

https://app.athento.com/file/view/_/?filter=<filtro>&display=<modo>

where,

  • <modo>, is the display mode that we want to show. There are two types of previews: “carrousel” or “list”.

    • The carrousel mode will display a carousel with previews of the related documents.

Athento_Created_by_filter_y_Postman.png

    • The list mode (list) will display a list with the related documents and operations on the documents themselves.

Athento_Created_by_filter.png

NOTE: It is important to note that the preview can be used in the URL in addition to all the previous functionalities, that is, in addition to filtering by metadata to locate the document we could create it if it does not exist, using the space and the form type to finally preview it in the mode we want.

 

Security

To perform embedded preview, it is necessary to use an additional security token in the URL that will control access to Athento, leaving the URL like this:

https://app.athento.com/file/view/_/?token=<token>&filter=<filtro>&display=<modo>

where,

  • <token>, is the limited-use access token.

To obtain a security token for the use of previewing a document via filtering, it is necessary to obtain it with the following authenticated API call (any type of authentication available in Athento can be used to perform the call, for example BasicAuth).

GET https://app.athento.com/users/api/access/access_token/?duration=<duracion>

where,

  • <duracion>, is the duration that the token will have before it expires and cannot be used. The duration format is based on time units, for example, use “1d5h” to set a duration of 1 day and 5 hours. The possible units are: “s” for seconds, “m” for minutes, “h” for hours, “d” for days. Some examples:

    • 5m: duration of 5 minutes
    • 10h: duration of 10 hours
    • 20d: duration of 20 days
    • 15d10m30s: duration of 15 days 10 minutes and 30 seconds.

Filter format

The filter format must be a string like:

metadata.num_proveedor=12345&metadata.num_proyecto=987

This string must be base64 encoded.

Please contact support@athento.com to specify the final format since, for security reasons, this format is not published.

Previewable extensions

Athento allows previewing of the extensions.

  • .pdf
  • .eml
  • .msg
  • .png
  • .jpg
  • .jpeg
  • .gif
  • .svg
  • .raw
  • .tiff
  • .tif

 

Related articles

 

How to preview documents via a filter in the URL?