Actions APIs

The Actions API enables Hyperflow users to create, update, delete or retrieve integrations or tasks, called Actions.

/admin/actions/get
Retrieve the information about your existing Actions
REST API
GET /admin/actions/get
Input query parameters
id
Optional
if provided, this API returns information about the action matching the id provided. Otherwise, it returns the full list of actions.
Example of a call to retrieve the full list of Actions:
curl https://{{ tenant }}.lightenup.ai/admin/actions/get \
--request GET \
--header "Authorization: Bearer xyz"
Example a call to retrieve a particular Action:
curl https://{{ tenant }}.lightenup.ai/admin/actions/get?id={{id}} \
--request GET \
--header "Authorization: Bearer xyz"

Outputs
Response Code
200

This API returns an array of Actions in JSON format:

id
Id of the Action retrieved
name
Name of the Action
content
Action code in javascript
type
Type of Action
state
The current state,
0 disabled and 1 enabled
created_at
Date and time of Action creation
last_updated
Date and of Action latest update
Response example:
[
 {
    "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9",
    "name": "order_cancellation",
    "description": "This action calls order management API to cancel an order",
    "content": "console.log('Hello world!')",
    "type": "automation",
    "state": "1",
    "created_at": "2024-02-16T20:23:54.025Z",
    "last_update": "2024-02-16T20:23:54.025Z"
  }
]

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters"
}

Response Code
500

Error message in JSON format:

message
Error message
Response exdmple:
{
  "message": "Internal server error"
}
/admin/actions/create
Creates a new Action
REST API
POST /admin/actions/create
Input Body parameters (JSON)
name
required
Name of the Action creted
description
required
Description of the Action created
type
required
The type of Action
content
required
The action code in javascript
state
required
The current state,
0 disabled and 1 enabled
Example of a call to retrieve the full list of Actions:
curl https://{{ tenant }}.lightenup.ai/admin/actions/create \
--request POST \
--header "Authorization: Bearer xyz" \
--header "Content-Type: application/json" \
--data @- << EOF
{
 "name": "order_cancellation",
 "description": "This action calls order management API to cancel an order",
 "content": "console.log('Hello world!')",
 "type": "automation",
 "state": "1",
}
EOF

Outputs
Response Code
200

This API returns an array of Actions in JSON format:

message
Action created
id
The id of the Action created
Response example:
{
  "message": "Action created",
  "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9"
}

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters"
}

Response Code
500

Error message in JSON format:

message
Error message
Response exdmple:
{
  "message": "Internal server error"
}
/admin/actions/update
Updates an existing Action
REST API
POST /admin/actions/update
Input Body parameters (JSON)
id
required
Id of the Action to be updated
name
required
The new name of the Action being updated
description
required
The new description of the Action being updated
type
required
The new type of the Action being updated
content
required
The new code in javascript
Example of a call to retrieve the full list of Actions:
curl https://{{ tenant }}.lightenup.ai/admin/actions/update \
--request POST \
--header "Authorization: Bearer xyz" \
--header "Content-Type: application/json" \
--data @- << EOF
{
 "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9",
 "name": "order_cancellation",
 "description": "This action calls order management API to cancel an order",
 "content": "console.log('Hello world!')",
 "type": "automation",
 "state": "1",
}
EOF

Outputs
Response Code
200

This API returns an array of Actions in JSON format:

message
Action updated
id
The id of the Action updated
Response example:
{
  "message": "Action updated",
  "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9"
}

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters"
}

Response Code
500

Error message in JSON format:

message
Error message
Response exdmple:
{
  "message": "Internal server error"
}
/admin/actions/delete
Deletes an existing Action
REST API
POST /admin/actions/delete
Input Body parameters (JSON)
id
required
Id of the Action to be deleted
Example of a call to retrieve the full list of Actions:
curl https://{{ tenant }}.lightenup.ai/admin/actions/delete?id=111 \
--request DELETE \
--header "Authorization: Bearer xyz"

Outputs
Response Code
200

This API returns an array of Actions in JSON format:

message
Action deleted
id
The id of the Action deleted
Response example:
{
  "message": "Action deleted",
  "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9"
}

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters"
}

Response Code
500

Error message in JSON format:

message
Error message
Response exdmple:
{
  "message": "Internal server error"
}