本文へスキップ

API/Manual Execution Event Source

When you select API/Manual Execution as the Event Source for the Flux App, the App is triggered when the API endpoint receives a request.

コピー/保存

このページはまだ日本語では利用できません。現在は英語版を表示しています。ブラウザの翻訳機能をご利用ください。

ブラウザで翻訳する
  • Chrome / Edge: アドレスバーの翻訳アイコン、またはページを右クリックして「日本語に翻訳」を選択してください。
  • Safari: アドレスバーの「aA」メニューから「翻訳」を選択してください。

翻訳メニューが表示されない場合は、ブラウザ設定で翻訳機能が有効になっているか確認してください。

英語版を見る

API/Manual Execution Event Source

When you select API/Manual Execution as the Event Source for the Flux App, the App is triggered when the API endpoint receives a request.

Sending Data to a Channel

With the API/Manual Execution event source, you can send data over the Soracom API to your Flux App channel. For more information on sending a request to the Soracom API, refer to the Soracom API Usage Guide.

Locating the Channel API Endpoint URL

The API endpoint can be found under the Event Source tab of the channel.

Viewing the API endpoint URL of a channel

Here is the format of the API endpoint URL:

https://g.api.soracom.io/v1/flux/apps/{app_id}/channels/{channel_id}/messages

This includes the following variables:

VariableDescription
app_idReplace with the ID of the Flux App.
channel_idReplace with the ID of the channel.

g.api.soracom.io is the domain for Global coverage. Use api.soracom.io for Japan coverage. For more details, refer to the Soracom API Usage Guide.

Sending an Example Request

Below you can find an example of sending {"temperature": 25} to the API endpoint of a channel:

curl -X POST "https://g.api.soracom.io/v1/flux/apps/01ABCDEFGHIJKLMNOPQRSTU/channels/01VWXYZABCDEFGHIJKLM/messages" \
  -H "X-Soracom-API-Key: $X_Soracom_API_KEY" \
  -H "X-Soracom-Token: $X_Soracom_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"temperature": 25}'

To reference the event source's Message in an action, you can use ${event.payload.<MESSAGE_ATTRIBUTE>} or event.payload.<MESSAGE_ATTRIBUTE> == 1.

Limitations of the API/Manual Execution Event Source: !!! The maximum payload that can be sent on a channel is 32,768 bytes;. Payloads exceeding this limit cannot be sent.

Data Format

The data sent to a channel configured with the API/Manual Execution event source consists of Message and Context.

You can check the data received by the event to the Flux App in the History tab of Soracom Flux Studio. For more details, refer to View Logs.

Message

For this event source, the message is the data sent to the API endpoint. Here's an example:

{
  "temperature": 25
}

Context

This contains the information about the event source.

{
  "eventType": "api"
}

The attributes are as follows:

AttributeDescription
eventTypeThe type of event. When the data sent via the API triggers the Flux App, the value is api.
検索 Escで閉じる / Enterで検索結果