Menu
API коротких URL
Note
Starting in Grafana 13,
/apiendpoints are being deprecated in favor of the/apisroute. Note that while Grafana is working on migrating existing APIs, currently there may not be an exact match to the legacy API you’re using.This change doesn’t disrupt or break your current setup. Legacy APIs are not being disabled and remain fully accessible and operative, but
/apiroutes will no longer be updated.To learn more refer to the new API structure in Grafana.
Используйте этот API для создания сокращённых URL. Короткий URL представляет более длинный URL со сложными параметрами запроса в меньшем и более простом формате.
Создание короткого URL
POST /api/short-urls
Создаёт короткий URL.
Пример запроса:
POST /api/short-urls HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVICE_ACCOUNT_TOKEN>
{
"path": "d/TxKARsmGz/new-dashboard?orgId=1&from=1599389322894&to=1599410922894"
}
Схема тела JSON:
- path – путь для сокращения, относительно root_url Grafana.
Пример ответа:
HTTP/1.1 200
Content-Type: application/json
{
"uid": AT76wBvGk,
"url": http://localhost:3000/goto/AT76wBvGk?orgId=1
}
Коды состояния:
- 200 – Создано
- 400 – Ошибки (некорректный JSON, отсутствующие или недопустимые поля)