# LINE Things API reference

# LINE Things API

LINE Things not available on iOS v9.19.0 or later

Due to a technical issue, we've temporarily suspended LINE Things functionality on LINE for iOS v9.19.0 and later.

# 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.

Example request

# HTTP request

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

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

deviceId

Device ID

# Response

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

id

String

Device ID

productId

String

Product ID

productSpecificDeviceId

String

PSDI.

Example response

# 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.

# Acquiring device information by specifying product ID and user ID

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

Example request

# HTTP request

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

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

productId

Product ID

userId

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

# Response

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

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

String

Product ID

items[].device.productSpecificDeviceId

String

PSDI.

items[].deviceDisplayName

String

Product name

Example response

# 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.

# 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 trial product information items per channel.

Example request

# HTTP request

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

# Request headers

Authorization

Bearer {channel access token}

Content-Type

application/json

# Request body

name

String

Product name

# Response

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

id

String

Product ID

name

String

Product name

type

String

Product type (BLE only)

channelId

Number

Channel ID of the channel for Messaging API associated with the trial product information

serviceUuid

String

Service UUID for service search *
This UUID is automatically numbered.

psdiServiceUuid

String

Service UUID for device identification*

psdiCharacteristicUuid

String

Characteristic UUID for device identification*

*These values are written to the device. For more information, see Creating devices.

Example response

# 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 product information items. Delete the unnecessary trial product information items.

# Acquiring trial product information

Acquire the created trial product information.

Example request

# HTTP request

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

# Request headers

Authorization

Bearer {channel access token}

# Response

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

[].id

String

Product ID

[].name

String

Product name

[].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

Example response

# Error response

One of the following status codes is returned.

Status code Description
401 Authentication failed.

# Deleting the trial product information

Specify the product ID, and delete the trial product information.

Example request

# HTTP request

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

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

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 information not found.
  • There is no access permission.

# Scenario management API for automatic communication

# Create or update a scenario set

Register (create or update) a scenario set for automatic communication under a product.

Example request

# HTTP request

PUT https://api.line.me/things/v1/products/{productId}/scenario-set

# Request headers

Authorization

Bearer {channel access token}

Content-Type

application/json

# Path parameters

productId

Product ID

# Request body

autoClose

Boolean

Specifies whether LINE should disconnect from the device after any scenario in the scenario set finishes running. If false, the connection is maintained. Pay careful attention to the values you use for these parameters. See also Important notes related to using automatic communication in the LINE Things documentation.

suppressionInterval

Number

If autoClose = true, this specifies the time (in milliseconds) before LINE should try to reconnect to the device after automatic disconnection. Reconnecting after the specified interval is not guaranteed to work. Depending on the environment in which LINE is running, the reconnection time may vary significantly. If
autoClose = false, set this to 0.

scenarios

Array

Array of scenario

# Scenario

id

String

Scenario ID
Not necessary when creating or updating a scenario set.

trigger

Object

Condition that, when met, starts the scenario.

trigger.type

String

  • IMMEDIATE: Perform an action as soon as your device connects to the LINE app.
  • BLE_NOTIFICATION: Perform an action when receiving a notification with the specified GATT characteristic value.

trigger.serviceUuid

String

GATT service UUID (128 bit) that must be in notification. Set only for
trigger.type = BLE_NOTIFICATION.

trigger.characteristicUuid

String

GATT characteristic UUID (128 bit) that must be in notification. Set only for
trigger.type = BLE_NOTIFICATION.

actions[]

Array

Array of Actions
action may be empty if the scenario's only purpose is to retrieve notification data.

actions[].type

String

Action type

  • SLEEP: Wait for a specified period of time.
  • GATT_READ: Read data from the specified GATT characteristic value.
  • GATT_WRITE: Write data to the specified GATT characteristic value.

actions[].sleepMillis

Number

Time to spend in SLEEP
It is not guaranteed that SLEEP will end after the specified time. Depending on the environment in which LINE is running, the time may vary significantly.
Set this property only when actions[].type is SLEEP.

actions[].serviceUuid

String

GATT service UUID (128 bit) including GATT characteristic that reads and writes data
Set this property only when actions[].type is GATT_READ or GATT_WRITE.

actions[].characteristicUuid

String

GATT service characteristic (128 bit) that reads and writes data
Set this property only when actions[].type is GATT_READ or GATT_WRITE.

actions[].data

String

Base64 encoded data
Set this property only when actions[].type is GATT_WRITE.

# Response

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

productId

String

Product ID

autoClose

Boolean

Shows whether LINE will disconnect from the device after any scenario in the scenario set finishes running. If false, the connection is maintained. Think carefully about what value to specify for this property. See also Important notes related to using automatic communication in the LINE Things documentation.

suppressionInterval

Number

Specifies the time (in milliseconds) before LINE tries to reconnect with the device after automatic disconnection.
Reconnecting after the specified interval is not guaranteed to work. Depending on the environment in which LINE is running, the reconnection time may vary significantly.

revision

Number

Current revision of the scenario set. It is automatically incremented for each change.

scenarios

Array

Array of scenario

createdAt

Number

Date and time when the scenario set was created

updatedAt

Number

Date and time when the scenario set was updated

Example response

# Error response

One of the following status codes is returned.

Status code Description
400 The request contains an invalid value.
401 Authentication failed.
404 This status code means one of the following:
  • Product information not found.
  • There is no access permission.

# Get a scenario set

Get the scenario set registered under a product.

Example request

# HTTP request

GET https://api.line.me/things/v1/products/{productId}/scenario-set

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

productId

Product ID

# Response

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

productId

String

Product ID

autoClose

Boolean

Shows whether LINE will disconnect from the device after any scenario in the scenario set finishes running. If false, the connection is maintained. Think carefully about what value to specify for this property. See also Important notes related to using automatic communication in the LINE Things documentation.

suppressionInterval

Number

Specifies the time (in milliseconds) before LINE tries to reconnect with the device after automatic disconnection.
Reconnecting after the specified interval is not guaranteed to work. Depending on the environment in which LINE is running, the reconnection time may vary significantly.

revision

Number

Current revision of the scenario set. It is automatically incremented for each change.

scenarios

Array

Array of scenarios

createdAt

Number

Date and time when the scenario set was created

updatedAt

Number

Date and time when the scenario set was updated

Example response

# 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:
  • Product information not found.
  • There is no access permission.

# Delete a scenario set

Delete a scenario set registered under a product.

Example request

# HTTP request

DELETE https://api.line.me/things/v1/products/{productId}/scenario-set

# Request headers

Authorization

Bearer {channel access token}

# Path parameters

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:
  • Product information not found.
  • There is no access permission.