ADA.AI
Logo Base de Conhecimento

Publisher API

The "Publisher" functionality allows accessing the objects without having to access BIMachine, a way to present the object in another system or website. Click here and learn more about Publisher.

Creating Application Key

To create an "application key" it’s necessary to communicate with the Master user of the project, this resource is available in the menu called "My Accounts".
In the pop-up that opens, click on the "Application keys" tab, and then on "New apllication key".
Give this key a name, generate a Token and click "Save".
The token will be created, copy.

Geração da Chave de Autenticação para um Usuário

When making a POST request to the API passing the application key and the registered user’s email, BIMachine will generate this authentication key.
Request Method: POST
Caminho: /api/token-manager
Parameters:
Name
Description
Type
appKey
Application Key
string
key
API Key
string
Ex: http://apps.bimachine.com/api/token-manager?appKey=Chave de aplicação
Results:
Code
Description
Type
200
authentication object
Object (JSON)
To "generate the authentication key via API do the following applications:
Step 1:
Using the POST request method make the REST call to "URL":
https://apps.bimachine.com/api/token-manager?appKey=Application Key
Ex: https://app.bimachine.com/api/token-manager?appKey=8c116732f4cc0d718124941d3ea4e2b1
    Application Key: 8c116732f4cc0d718124941d3ea4e2b1
Passing an Authentication Object in the body of the request (BODY):
{
 "email": "example@bimachine.com.br" 
}
Step 2:
    Expected results when executing the call:
    Code 200 (OK): Return of an authentication object created in BIMachine
Response Content:
{
    "applicationKey": {
        "id": 110,
        "name": "Teste",
        "token": "8c116732f4cc0d718124941d3ea4e2b1",
        "blockByDomain": false,
        "allowedDomains": []
    },
    "user": {
        "id": 7526,
        "username": "<email.do.usuario>",
        "email": "<email.do.usuario>",
        "preferredLanguage": "pt_BR",
        "displayName": "Frederico da Silva Gasparini",
        "enabled": true,
        "preferences": {
            "id": 3630,
            "defaultProjectId": null,
            "cockpitPreferences": {
                "listView": false,
                "preferredSize": 253
            }
        },
        "phone": "(51) 9999-99999",
        "practiceProfile": null,
        "occupationArea": {
            "id": 111,
            "name": "Assistente Junior"
        },
        "dn": null,
        "timeZone": "America/Sao_Paulo",
        "createdAt": "2021-08-09T11:44:43.564-03:00",
        "updatedAt": "2021-08-17T10:53:33.658-03:00",
        "superUser": false,
        "avatarLink": "/avatar?user-id=7526&i=1629428400050&oi=0"
    },
    "token": "6ac6d5ae-025f-48dc-802e-58fed3bf317a",
    "createdAt": "2021-08-20T10:10:28.621-03:00",
    "lastRequestTime": "2021-08-20T10:10:28.621-03:00"
}

Accessing BIMachine Using Token

The "token": "6ac6d5ae-025f-48dc-802e-58fed3bf317a", returned is for the user to be able to authenticate in BIMachine and must be passed via a parameter in the URL;
Ex: https://app.bimachine.com?appToken=6ac6d5ae-025f-48dc-802e-58fed3bf317a
The Token Obtained with the application key and the user’s email are also valid for displaying a BIM object (analysis, dashboard, kpi and maps). To do this, just enter BIMachine, access the object that will be displayed, and click on the object’s publication menu, mark the enabled one and copy the generated link or incorporate it directly.
Copy the generated html code and add the attribute: &appToken=6ac6d5ae-025f-48dc-802e-58fed3bf317a
Ex: https://app.bimachine.com/spr/publisher/bigtable?content=%2Fprojeto-fred%2F7526%2F1363.bigtable&showUpdateDate=true&showTitle=true&chart=false&appToken=6ac6d5ae-025f-48dc-802e-58fed3bf317a
NOTE: The token has an expiration time of 30 minutes, after this period it needs to be renewed.
Note: Functionality enabled only for projects in PRODUCTION.

Expected end result

When completing all previous steps, we will have our Publisher ready for use on external sites.
Ex:
The REST requests we performed were made by the Postman software in this example.
If you have any questions, please contact us!

Latest Articles

Scroll to Top