Functions¶
Create a Function¶
- POST /_config/functions/¶
Description This is used for creating new asset.
HTTP Method POST
Endpoint:
/_config/functions/
Request Header
Authorization
Basic <token>Request Parameters
Body Parameters
function_name
(string, required): The name of the function to be created.plant_id
(string, required): The ID of the plant to which this function belongs.site_id
(string, optional): The ID of the site where the function is located.If not provided, it will be determined based on the plant_id.
Sample Request
curl --location 'https://app.4pointx.com/_config/functions/' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic <token>' \ --data ' {"function_name":"demo-func-oct9-test2", "plant_id":"e29ae75e-dd88-45ef-90cb-cefb3807af70" }'
Sample Response
Success
{ "id": "96978782-b0ea-49dc-9f87-2edf8ba2f126" }
Error
{ "error": { "status": 401, "message": "Unauthorized access to module by general-user" } }
{ "error": { "status": 400, "message": "Invalid Content Type" } }
{ "error": { "status": 400, "message": "Insufficient Inputs" } }
{ "error": { "status": 400, "message": "Invalid Plant id" } }
Delete a Function¶
- DELETE /_config/functions/<function_id>¶
Description This endpoint allows you to delete a specific function by providing its ID.
HTTP Method DELETE
Endpoint
/_config/functions/<function_id>
Request Header
Authorization
Basic <token>Request Parameters
URL Parameters
function_id
(string, required): The ID of the function to delete.
Sample Request
curl --location --request DELETE 'https://app.4pointx.com/_config/functions/1b78027a-b67f-4130-9325-0ab11a3cfd05' \ --header 'Authorization: Basic <token>' \ --data ''
Sample Response
Success
"Function deleted"
Error
{ "error": { "status": 401, "message": "Unauthorized access to module by general-user" } }
{ "error": { "status": 400, "message": "Invalid Function 1b78027a-b67f-4130-9325-0ab11a3cfd05" } }
{ "error": { "status": 400, "message": "Monitors exist on the function" } }
{ "error": { "status": 400, "message": "Assets exist on the function" } }
{ "error": { "status": 400, "message": "Monitors and assets both exist on the function" } }
Update Function¶
- PUT /_config/functions/<function_id>¶
Description This endpoint allows you to update the details of a specific function by providing its ID.
HTTP Method PUT
Endpoint
/_config/functions/<function_id>
Request Header
Authorization
Basic <token>Request Parameters
Body Parameters
function_name
(string, required): The updated name of the function.plant_id
(string, required): The updated ID of the plant to which this function belongs.
URL Parameters
function_id
(string, required): The ID of the function to update.
Sample Request
curl --location --request PUT 'https://app.4pointx.com/_config/functions/96978782-b0ea-49dc-9f87-2edf8ba2f126' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic YWRtaW46clpvcGN1S3FVSXFteXJPVUNibDVTZGx4bVQzYU55ZG0=' \ --data ' {"function_name":"demo-func-2sep-test2-mod", "plant_id":"e29ae75e-dd88-45ef-90cb-cefb3807af70"}'
Sample Response
Success
"Function Updated"
Error
{ "error": { "status": 401, "message": "Unauthorized access to module by general-user" } }
{ "error":{ "status": 400, "message": "Invalid Content Type" } }
{ "error":{ "status": 400, "message": "Insufficient Inputs" } }
{ "error":{ "status": 404, "message": "Invalid function" } }
Fetch Function¶
- GET /_config/functions/<function_id>¶
Description This endpoint allows you to retrieve details about a specific function by providing its ID.
HTTP Method GET
Endpoint
/_config/functions/<function_id>
Request Header
Authorization
Basic <token>Request Parameters
URL Parameters
function_id
(string, required): The ID of the function to retrieve details for.
Sample Request
curl --location 'https://app.4pointx.com/_config/functions/96978782-b0ea-49dc-9f87-2edf8ba2f126' \ --header 'Authorization: Basic <token>'
Sample Response
Success
{ "function_id": "96978782-b0ea-49dc-9f87-2edf8ba2f126", "function_name": "demo-func-oct9-test2mod", "plant_name": "Demo Plant", "site_name": "Demo Site" }
Error
{ "error": { "status": 401, "message": "Unauthorized access to module by general-user" } }
{ "error": { "status": 405, "message": "Method not allowed", } }
{ "error": { "status": 404, "message": "Data not found", } }
Fetch List of Functions¶
- GET /_config/functions/_list¶
Description This endpoint allows you to retrieve a list of functions associated with a specific plant.
HTTP Method GET
Endpoint
/_config/functions/_list
Request Header
Authorization
Basic <token>Request Parameters
Query Parameters
plant_id
(string, required): The ID of the plant for which you want to list functions.
Sample Request
curl --location 'https://app.4pointx.com/_config/functions/_list?plant_id=e29ae75e-dd88-45ef-90cb-cefb3807af70' \ --header 'Authorization: Basic <token>' \ --data ''
Sample Response
Success
[ { "function_id": "45c98f40-75e3-49e7-b178-d25ec878db79", "function_name": "Demo Function", "plant_name": "Demo Plant", "site_name": "Demo Site", "monitor_count": 7 }, { "function_id": "1eede0dd-93a6-4c0d-803e-4f41ff9728c1", "function_name": "Line 1", "plant_name": "Demo Plant", "site_name": "Demo Site", "monitor_count": 5 }, { "function_id": "8ca0f8cf-8128-47a5-843c-50e4cf9e5033", "function_name": "func22sep", "plant_name": "Demo Plant", "site_name": "Demo Site", "monitor_count": 1 }, { "function_id": "96978782-b0ea-49dc-9f87-2edf8ba2f126", "function_name": "demo-func-oct9-test2mod", "plant_name": "Demo Plant", "site_name": "Demo Site", "monitor_count": 0 } ]
Error
{ "error": { "status": 401, "message": "Unauthorized access to module by general-user" } }
{ "error": { "status": 400, "message": "Insufficient Inputs" } }