LINE Things API reference

LINE Things API

Specifying product ID to acquire PSDI by device ID

Specify the device ID, and acquire the product ID and PSDI. Used when acquiring the product ID and PSDI from the device ID acquired by the device link/unlink event.

For more information about the device ID, product ID, and PSDI, see IDs.

HTTP request

GET https://api.line.me/things/v1/devices/{deviceId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
deviceId Device ID

Example request

curl -X GET https://api.line.me/things/v1/devices/{deviceId} \
-H "Authorization: Bearer {channel access token}"

Response

Returns the status code 200 and a JSON object with the following properties.

Property Type Description
id String Device ID
productId Number Product ID
productSpecificDeviceId String PSDI.

Error response

One of the following status codes is returned.

Status code Description
401 Authentication failed.
404 This status code means one of the following:
  • Device not found.
  • There is no access permission.

Example response

{
  "id": "{deviceId}",
  "productId": {productId},
  "productSpecificDeviceId": "{PSDI}"
}

Acquiring device information by specifying product ID and user ID

Specify the product ID and user ID, and acquire the device information.

HTTP request

GET https://api.line.me/things/v1/products/{productId}/users/{userId}/links

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
productId Product ID
userId User ID. User ID value is a string matching the regular expression pattern U[0-9a-f]{32}.

Example request

curl -X GET https://api.line.me/things/v1/products/{productId}/users/{userId}/links \
-H "Authorization: Bearer {channel access token}"

Response

Returns the status code 200 and a JSON object with the following properties.

Property Type Description
items[].userId String User ID
User ID value is a string matching the regular expression pattern U[0-9a-f]{32}.
items[].device.id String Device ID
items[].device.productId Number Product ID
items[].device.productSpecificDeviceId String PSDI.
items[].deviceDisplayName String Product name

Error response

One of the following status codes is returned.

Status code Description
401 Authentication failed.
404 This status code means one of the following:
  • Device not found.
  • There is no access permission.

Example response

{
  "items": [
    {
      "userId": "{userId}",
      "device": {
        "id": "{deviceId}",
        "productId": {productId},
        "productSpecificDeviceId": "{PSDI}"
      },
      "deviceDisplayName": "{Product Name}"
    },
    {
      "userId": "{userId}",
      "device": {
        "id": "{deviceId}",
        "productId": {productId},
        "productSpecificDeviceId": "{PSDI}"
      },
      "deviceDisplayName": "{Product Name}"
    }
  ]
}

Creating trial product information

Create and register trial product information on the LINE Platform to ensure that Bluetooth® Low Energy-compatible devices can be used with the LINE Things Developer Trial. As a result of this operation, the trial product information and the Messaging API channel can be associated with each other.

Note: You can create a maximum of 10 instances of trial product information per channel.

HTTP request

POST https://api.line.me/things/v1/trial/products

Request headers

Request header Description
Authorization Bearer {channel access token}
Content-Type application/json

Request body

Field Type Description
name String Name of the trial product
liffId String LIFF app ID associated with the created product

Example request

curl -X POST https://api.line.me/things/v1/trial/products \
-H "Authorization: Bearer {channel access token}" \
-H "Content-Type: application/json" \
-d '{
  "name": "{trial product name}",
  "liffId": "{LIFF APP ID}"
}'

Response

Returns the status code 200 and a JSON object with the following properties.

Property Type Description
id Number Product ID
name String Name of the product
type String Product type (BLE only)
channelId Number Channel ID of the channel for Messaging API associated with the trial product information
actionUri String URL of the LIFF app
serviceUuid String Service UUID for service search *
This UUID is automatically numbered.
psdiServiceUuid String Service UUID for device identification*
psdiCharacteristicUuid String The characteristic UUID for device identification*

*These values are written to the device and LIFF app. For more information, see "Creating devices" and "Finalizing the LIFF app".

Error response

One of the following status codes is returned.

Status code Description
400 The request contains an invalid value.
401 Authentication failed.
403 You've reached the maximum of 10 trial products. Delete the unnecessary trial products.

Example response

{
  "id": {productId},
  "name": "{trial product name}",
  "type": "BLE",
  "channelId": {channelId},
  "actionUri": "{LIFF APP URL}",
  "serviceUuid": "{serviceUuid}",
  "psdiServiceUuid": "{psdiServiceUuid}",
  "psdiCharacteristicUuid": "{psdiCharacteristicUuid}"
}

Acquiring a trial product

Acquire the created trial product.

HTTP request

GET https://api.line.me/things/v1/trial/products

Request headers

Request header Description
Authorization Bearer {channel access token}

Example request

curl -X GET https://api.line.me/things/v1/trial/products \
-H "Authorization: Bearer {channel access token}"

Response

Returns the status code 200 and a JSON object with the following properties.

Property Type Description
[].id Number Product ID
[].name String Product name
[].actionUri String URL of the LIFF app
[].channelId Number Channel ID of the channel for Messaging API associated with the trial product information
[].type String Product type ("BLE" only)
[].serviceUuid String Service UUID for service search
[].psdiServiceUuid String Service UUID for device identification
[].psdiCharacteristicUuid String Characteristic UUID for device identification

Error response

One of the following status codes is returned.

Status code Description
401 Authentication failed.

Example response

[
  {
    "id": {productId},
    "name": "{trial product name}",
    "actionUri": "{LIFF APP URL}",
    "channelId": {channelId},
    "type": "BLE",
    "serviceUuid": "{serviceUuid}",
    "psdiServiceUuid": "{psdiServiceUuid}",
    "psdiCharacteristicUuid": "{psdiCharacteristicUuid}"
  }
]

Deleting the trial product

Specify the product ID, and delete the trial product.

HTTP request

DELETE https://api.line.me/things/v1/trial/products/{productId}

Request headers

Request header Description
Authorization Bearer {channel access token}

Path parameters

Parameter Description
productId Product ID

Response

Status code 204 is returned.

Error response

One of the following status codes is returned.

Status code Description
401 Authentication failed.
404 This status code means one of the following:
  • Trial product not found.
  • There is no access permission.

Example request

curl -X DELETE https://api.line.me/things/v1/trial/products/{productId} \
-H "Authorization: Bearer {channel access token}"

{{ $t("form.question.helpful") }}

{{ $t("form.question.detail") }}

{{ $t("form.question.improve") }}

{{ $t("form.info.start") }}{{ $t("form.info.link") }}{{ $t("form.info.end") }}


{{ $t("form.result.success") }}
{{ $t("form.result.error") }}
{{ $t("form.result.errorLink") }}