Add Service to Product

Description

Add a Service to a product to allow devices to make service invocations to it through the Basestation.

Request

POST /v1/n5/products/:productId/services
{
  serviceId: string
}

Response

Successful response contains the following JSON formated body:

{
   productId: string,
  organizationId: string,
  name: string|null,
  created: string,
  currentBatchId: number,
  tags: {
    [key: string]: string
  },
  deleted: boolean,
  markedForDeletion: boolean,
  expiresAt: string|null,
  apps: string[],
  services: string[],
  configuredDevices: number 
}

Response Status codes:

  • 200 on success

Request headers

This request must have the following headers:

  • Authorization: bearer <ApiKey>
  • X-Nabto-Organization: <organizationId>
  • Content-Type: application/json

Example

Request

curl -XPOST "https://api.cloud.nabto.com/v1/n5/products/:productId/services" \
  -H "Authorization: Bearer <ApiKey>" \
  -H "X-Nabto-Organization: <OrganizationId>" \
  -H "Content-Type: application/json" \
  -d '{ serviceId: "se-xyabzwcd"}'

Response

{
   productId: "pr-abcdefgh",
  organizationId: "or-lmnopqrs",
  name: "friendly name",
  created: "2022-10-18T10:17:24.299Z",
  currentBatchId: 42,
  tags: {
    "foo": "bar" 
  },
  deleted: true,
  markedForDeletion: true,
  expiresAt: "2022-10-18T10:17:24.299Z",
  apps:[ "ap-abcdwxyz",
  ...],
  services:[ "se-xyabzwcd",
  ...],
  configuredDevices: 42
}