Ресурс

Service

Services is a collection of services that you have in your organization. It can be a collection of services that you are monitoring or services that you are providing to your customers. It can be anything that you want to keep track of.

Модель Service

Свойства

  • Имя
    _id
    Тип
    Object ID
    Описание

    ID of this object

  • Имя
    createdAt
    Тип
    Date
    Описание

    Date and Time when the object was created.

  • Имя
    updatedAt
    Тип
    Date
    Описание

    Date and Time when the object was updated.

  • Имя
    project
    Тип
    Project
    Описание

    Relation to Project Resource in which this object belongs

  • Имя
    projectId
    Тип
    Object IDОбязательно
    Описание

    ID of your Project in which this object belongs

  • Имя
    name
    Тип
    TextОбязательно
    Описание

    Any friendly name of this object

  • Имя
    slug
    Тип
    SlugОбязательно
    Описание

    Friendly globally unique name for your object

  • Имя
    description
    Тип
    Long Text
    Описание

    Friendly description that will help you remember

  • Имя
    createdByUser
    Тип
    User
    Описание

    Relation to User who created this object (if this object was created by a User)

  • Имя
    createdByUserId
    Тип
    Object ID
    Описание

    User ID who created this object (if this object was created by a User)

  • Имя
    labels
    Тип
    Label
    Описание

    Relation to Labels Array where this object is categorized in.

  • Имя
    serviceColor
    Тип
    Color
    Описание

    Color for this service

  • Имя
    techStack
    Тип
    JSON
    Описание

    Tech stack used in the service. This will help other developers understand the service better.

  • Имя
    retainTelemetryDataForDays
    Тип
    Number
    Описание

    Number of days to retain telemetry data for this service.

GETorPOST/api/service/get-list

Список

Этот метод возвращает постраничный список ваших объектов «Service». По умолчанию на странице до десяти записей.

Необязательные query-параметры

  • limit
    число
    Сколько объектов вернуть. По умолчанию 10, максимум 100
  • skip
    число
    Сколько объектов пропустить (для пагинации)

Необязательное тело запроса

Запрос списка

POST
/api/service/get-list?skip=0&limit=10
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "select": {
    "name": true,
    "projectId": true,
    "createdByUserId": true,
    "description": true,
    "slug": true
  },
  "query": {
    "name": "User Authentication API"
  },
  "sort": {
    "createdAt": -1
  }
}

Ответ

{
  "count": 10,
  "limit": 10,
  "skip": 0,
  "data": [
    {
      "_id": "377a9260-28fe-11f1-b591-3fdcef396aba",
      "name": "User Authentication API",
      "projectId": "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
      "createdByUserId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "description": "RESTful API service that handles user authentication, authorization, and session management for the platform",
      "slug": "Example slug"
    },
    {
      "_id": "377a9261-28fe-11f1-b591-3fdcef396aba",
      "name": "User Authentication API",
      "projectId": "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
      "createdByUserId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "description": "RESTful API service that handles user authentication, authorization, and session management for the platform",
      "slug": "Example slug"
    },
    {
      "_id": "377a9262-28fe-11f1-b591-3fdcef396aba",
      "name": "User Authentication API",
      "projectId": "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
      "createdByUserId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "description": "RESTful API service that handles user authentication, authorization, and session management for the platform",
      "slug": "Example slug"
    }
  ]
}
GETorPOST/api/service/:id/get-item

Получить по ID

Возвращает объект «Service» по идентификатору.

  • id
    строка
    ID объекта

Необязательное тело запроса

  • select
    По умолчанию возвращается только ID; для других полей используйте select. Подробнее: как выбирать поля.

Запрос одного объекта

POST
/api/service/:id/get-item
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "select": {
    "name": true,
    "projectId": true,
    "createdByUserId": true,
    "description": true,
    "slug": true
  }
}

Ответ

{
  "_id": "377a9260-28fe-11f1-b591-3fdcef396aba",
  "name": "User Authentication API",
  "projectId": "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
  "createdByUserId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "description": "RESTful API service that handles user authentication, authorization, and session management for the platform",
  "slug": "Example slug"
}
POST/api/service/count

Количество

Возвращает количество ваших объектов «Service».

Необязательное тело запроса

Запрос количества

POST
/api/service/count
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "query": {
    "name": "User Authentication API"
  }
}

Ответ

{
  "count": 107
}
POST/api/service

Создать Service

Создаёт новый объект.

Запрос создания

POST
/api/service
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "data": {
    "name": "User Authentication API",
    "projectId": "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
    "createdByUserId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "description": "RESTful API service that handles user authentication, authorization, and session management for the platform",
    "createdByUser": "Example created by user"
  }
}

Ответ

{
  "_id": "377a9260-28fe-11f1-b591-3fdcef396aba",
  "name": "User Authentication API",
  "projectId": "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
  "createdByUserId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "description": "RESTful API service that handles user authentication, authorization, and session management for the platform",
  "slug": "Example slug"
}
PUT/api/service/:id

Обновить по ID

Обновляет объект по ID.

Альтернативные методы

Если клиент не поддерживает PUT, используйте POST или GET с теми же заголовками и телом:

POST/api/service/:id/update-item
GET/api/service/:id/update-item

Запрос обновления

PUT
/api/service/:id
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY
Тело
{
  "data": {
    "name": "User Authentication API",
    "description": "RESTful API service that handles user authentication, authorization, and session management for the platform",
    "labels": []
  }
}

Ответ

{}
DELETE/api/service/:id

Удалить по ID

Удаляет объект по ID.

Альтернативные методы

Если клиент не поддерживает DELETE, используйте POST или GET с теми же заголовками и телом:

POST/api/service/:id/delete-item
GET/api/service/:id/delete-item

Запрос удаления

DELETE
/api/service/:id
Заголовки
Content-Type: application/json
ApiKey: YOUR_API_KEY

Ответ

{}

Права доступа

Для операций с ресурсом у ключа API должны быть права. При их отсутствии вернётся ответ 4xx.

Права на чтение

Нужны для чтения Service

  • Project Owner
  • Project Admin
  • Project Member
  • Project Member
  • Read Service
  • Read All Project Resources

Права на создание

Нужны для создания Service

  • Project Owner
  • Project Admin
  • Project Member
  • Create Service

Права на обновление

Нужны для обновления Service

  • Project Owner
  • Project Admin
  • Project Member
  • Edit Service

Права на удаление

Нужны для удаления Service

  • Project Owner
  • Project Admin
  • Project Member
  • Delete Service