Upload Assets with Public API

Создано: Denis Kotov, Изменено Fri, 19 May 2023 на 01:46 PM по Denis Kotov

For some use cases (for example single source of truth about all  your assets in compnay ) you can easly upload assets from your backend to Storm.  To achive that you need:


1. Get API KEY

2. Send POST request to https://stormbpmn.com/public-api/v1/assets (or your <server-url>/public-api/v1/assets/ for enterprise customers)

3. Add HEADER "X-Api-Key"  with your api key, that you receivedin 1 step.

4.  Generate BODY for your request. Storm accept JSON Array with structure:

  • id - asset id in Storm
  • externalId - asset id in your system
  • name* - asset name
  • description - asset description
  • externalUrl - url pattern for links to your asset in your system ( for example https://mywiki.corp.com/entity/${externalId} )
  • type - asset type,  it is enum, possible value UNSPECIFIED, DOCUMENT, SYSTEM, COMMUNCATION, CLIENT, ENTITY, ACTION, OTHER

For example:

     [
{
"id": null,
"externalId": null,
"name": "B2C USER",
"description": "",
"externalUrl": null,
"type": "CLIENT"
}
]

5.  If id or externalId not provided, a new asset will be created.  If you provide externalId, Storm will update this asset. If you provide id, Storm will update this asset. If you provide externalId and id, asset with id will updated. Default type is UNSPECIFIED.



6. Recive response and do whatever you want with that. Response structure is JSON Array with same scructure and additional fields:

  • createdOn - date of creation.
  • updatedOn - date of update.
  • updatedBy - email of admin, witch associated with API key.

ortant info:

- Assets created with team admin username.

- Maximum Assets  in one request - 20.

- Default rate limit  - 5 requests in 1 minute.  You can find remaining request in each response header X-Rate-Limit-Remaining.

- Default size of 1 request - 10 Mb. You cannot upload more in one request. 

If you reach your quota you will get that message:

{
"timestamp": "2022-06-28T12:03:03.438+00:00",
"status": 429,
"error": "Too Many Requests",
"message": "You have exhausted your API Request Quota",
"path": "/public-api/v1/upload-diagrams"
}

In response header X-Rate-Limit-Retry-After-Seconds you can find how much second you need wait before another try. If you reach your limit more that 3 times in 24 hour, you api key will be banned forever (but if you really need more or something bad happens, write us via email storm@bpmn2.ru, we will help).




Статья помогла?

Отлично!

Спасибо за ваш отзыв

Извините, что не удалось помочь!

Спасибо за ваш отзыв

Расскажите, как мы можем улучшить эту статью!

Выберите хотя бы одну причину
Требуется проверка CAPTCHA.

Комментарий отправлен

Мы ценим вашу помощь и постараемся исправить статью