Plants

Create a Plant

POST /_config/plants/

Description This is used for creating new plant.

HTTP Method POST

Endpoint: /_config/plants/

Request Header Authorization Basic <token>

Request Parameters

Body Parameters

  • plant_name (string, required): The name of the plant to be created.

  • site_id (string, required): The ID of the site to which this plant belongs.

Sample Request

curl --location 'https://app.4pointx.com/_config/plants' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic <token>' \
    --data '
       {"plant_name":"test-plant-test1",
        "site_id":"d2e66edd-f13f-4d00-a7b5-8cab9ef4488d"}
       '

Sample Response

Success

{
  "id": "b33ad9e3-d5ba-4083-a05d-d378851f5b51"
}

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 Site Id"
  }
}
{
  "error": {
    "status": 400,
    "message":  "Plant Name Should Be Unique"
  }
}

Delete a Plant

DELETE /_config/plants/<plant_id>

Description Delete a specific plant by providing its ID.

HTTP Method DELETE

Endpoint /_config/plants/<plant_id>

Request Header Authorization Basic <token>

Request Parameters

URL Parameters

  • plant_id (string, required) The ID of the plant to delete.

Sample Request

curl --location --request DELETE 'https://app.4pointx.com/_config/plants/b33ad9e3-d5ba-4083-a05d-d378851f5b51' \
      --header 'Authorization: Basic <token>' \

Sample Response

Success

"Plant deleted"

Error

{
  "error": {
    "status": 401,
    "message": "Unauthorized access to module by general-user"
  }
}
{
  "error": {
      "status": 400,
      "message": "Events exist for b33ad9e3-d5ba-4083-a05d-d378851f5b51"
      }
}
{
  "error": {
      "status": 400,
      "message": "Pipelines exist for b33ad9e3-d5ba-4083-a05d-d378851f5b51"
      }
}
{
  "error": {
      "status": 400,
      "message": "Assets exist for b33ad9e3-d5ba-4083-a05d-d378851f5b51"
      }
}
{
  "error": {
      "status": 400,
      "message": "Functions exists on the plant"
      }
}

Update Plant

PUT /_config/plants/<plant_id>

Description Update the details of a specific plant by providing its ID.

HTTP Method PUT

Endpoint /_config/plants/<plant_id>

Request Header Authorization Basic <token>

Request Parameters

Body Parameters

  • plant_name (string, required): The updated name of the plant.

  • site_id (string, required): The ID of the site to which this plant belongs.

URL Parameters

  • plant_id (string, required) The ID of the plant to update.

Sample Request

curl --location --request PUT 'https://app.4pointx.com/_config/plants/b33ad9e3-d5ba-4083-a05d-d378851f5b51' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Basic <token>' \
     --data '
     {"plant_name":"test-plant-1sep-mod",
      "site_id":"d2e66edd-f13f-4d00-a7b5-8cab9ef4488d"}
        '

Sample Response

Success

"Plant 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": 400,
   "message": "Invalid Plant"
}
}
{
"error": {
   "status": 400,
   "message":  "Plant Name Should Be Unique"
}
}

Fetch Plant

GET /_config/plants/<plant_id>

Description Retrieve details about a specific plant by providing its ID.

HTTP Method GET

Endpoint /_config/plants/<plant_id>

Request Header Authorization Basic <token>

Request Parameters

URL Parameters

  • plant_id (string, required): The ID of the plant to retrieve details for.

Sample Request

curl --location 'http://app.4pointx.com/_config/plants/b33ad9e3-d5ba-4083-a05d-d378851f5b51' \
     --header 'Authorization: Basic <token>'

Sample Response

Success

{
  "plant_id": "b33ad9e3-d5ba-4083-a05d-d378851f5b51",
  "plant_name": "test-plant-1sep-test1",
  "site_id": "d2e66edd-f13f-4d00-a7b5-8cab9ef4488d",
  "site_name": "Demo Site"
}

Error

{
  "error": {
    "status": 401,
    "message": "Unauthorized access to module by general-user"
  }
}
{
  "error": {
    "status": 400,
    "message":  "Invalid Plant for 5476481-48e5-b2a0-ae810a948839"
  }
}
{
  "error": {
    "status": 405,
    "message": "Method Not Allowed"
  }
}

Fetch List of Plants

GET /_config/plants/_list

Description Retrieve a list of plants associated with a specific site.

HTTP Method GET

Endpoint /_config/plants/_list

Request Header Authorization Basic <token>

Request Parameters

Query Parameters

  • site_id (string, required): The ID of the site for which you want to list plants.

Sample Request

curl --location 'https://app.4pointx.com/_config/plants/_list?site_id=d2e66edd-f13f-4d00-a7b5-8cab9ef4488d' \
     --header 'Authorization: Basic <token>' \
     --data ''

Sample Response

Success

[
    {
       "plant_id": "e29ae75e-dd88-45ef-90cb-cefb3807af70",
       "plant_name": "Demo Plant",
       "site_id": "d2e66edd-f13f-4d00-a7b5-8cab9ef4488d",
       "site_name": "Demo Site",
       "function_count": 3,
       "pipeline_count": 10
    },
    {
       "plant_id": "bbdc76c9-6551-4cb2-b257-816a7ef172de",
       "plant_name": "teswt",
       "site_id": "d2e66edd-f13f-4d00-a7b5-8cab9ef4488d",
       "site_name": "Demo Site",
       "function_count": 0,
       "pipeline_count": 0
    }
 ]

Error

{
  "error": {
    "status": 401,
    "message": "Unauthorized access to module by general-user"
  }
}
{
  "error": {
    "status": 400,
    "message":  "Insufficient Inputs"
  }
}