Robot Documentations

Categories API

Manage target categories for organizing and classifying robot targets.

Get the list of categories

Retrieve all categories configured for the robot.

GET
/api/v1/categories

Response Body

Successful Response

responseRequiredResponse Get Categories Api V1 Categories Get
curl -X GET "http://localhost:7242/api/v1/categories"
fetch("http://localhost:7242/api/v1/categories")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "http://localhost:7242/api/v1/categories"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "http://localhost:7242/api/v1/categories"

response = requests.request("GET", url)

print(response.text)
[
  {
    "image": "",
    "label": "{\"name\":\"Beverages\"}",
    "cid": "1"
  }
]

Add a new category to the robot

Add a new category to the robot configuration.

POST
/api/v1/categories

Request Body

application/jsonRequired
imagestring | null | null
labelLabel

Category label json.

Default: "{}"
cidstring | null | null

Response Body

Successful Response

status_codeStatus Code

HTTP status code of the response.

Default: 200
successSuccess

Indicates whether the operation was successful.

Default: true
messageMessage

A message providing additional information about the operation.

Default: ""
dataobject | null | null
errorobject | null | null

Failed to add category

Validation Error

detailDetail
curl -X POST "http://localhost:7242/api/v1/categories" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "",
    "label": "{\"name\":\"Beverages\"}",
    "cid": "1"
  }'
const body = JSON.stringify({
  "image": "",
  "label": "{\"name\":\"Beverages\"}",
  "cid": "1"
})

fetch("http://localhost:7242/api/v1/categories", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "http://localhost:7242/api/v1/categories"
  body := strings.NewReader(`{
    "image": "",
    "label": "{\"name\":\"Beverages\"}",
    "cid": "1"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "http://localhost:7242/api/v1/categories"
body = {
  "image": "",
  "label": "{\"name\":\"Beverages\"}",
  "cid": "1"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
{
  "status_code": 200,
  "success": true,
  "message": "Operation successful",
  "data": {
    "key": "value"
  },
  "error": {
    "code": "ERROR_CODE",
    "message": "An error occurred"
  }
}
{
  "status_code": 400,
  "success": false,
  "message": "Failed to add category",
  "error": {
    "code": "CATEGORY_ADD_ERROR",
    "message": "Failed to add category"
  }
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Get a category by id

Retrieve a category by its category id.

GET
/api/v1/categories/{cid}

Path Parameters

cidRequiredCid

Response Body

Successful Response

imagestring | null | null
labelLabel

Category label json.

Default: "{}"
cidstring | null | null

Category not found.

Validation Error

detailDetail
curl -X GET "http://localhost:7242/api/v1/categories/string"
fetch("http://localhost:7242/api/v1/categories/string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "http://localhost:7242/api/v1/categories/string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "http://localhost:7242/api/v1/categories/string"

response = requests.request("GET", url)

print(response.text)
{
  "image": "",
  "label": "{\"name\":\"Beverages\"}",
  "cid": "1"
}
{
  "status_code": 404,
  "success": false,
  "message": "Category not found.",
  "error": {
    "code": "CATEGORY_NOT_FOUND",
    "message": "Category not found."
  }
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Update a category

Update category fields by category id.

PATCH
/api/v1/categories/{cid}

Request Body

application/jsonRequired
imagestring | null | null
labelstring | null | null

Path Parameters

cidRequiredCid

Response Body

Successful Response

status_codeStatus Code

HTTP status code of the response.

Default: 200
successSuccess

Indicates whether the operation was successful.

Default: true
messageMessage

A message providing additional information about the operation.

Default: ""
dataobject | null | null
errorobject | null | null

Failed to update category

Validation Error

detailDetail
curl -X PATCH "http://localhost:7242/api/v1/categories/string" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "",
    "label": "{\"name\":\"Beverages\"}"
  }'
const body = JSON.stringify({
  "image": "",
  "label": "{\"name\":\"Beverages\"}"
})

fetch("http://localhost:7242/api/v1/categories/string", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "http://localhost:7242/api/v1/categories/string"
  body := strings.NewReader(`{
    "image": "",
    "label": "{\"name\":\"Beverages\"}"
  }`)
  req, _ := http.NewRequest("PATCH", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "http://localhost:7242/api/v1/categories/string"
body = {
  "image": "",
  "label": "{\"name\":\"Beverages\"}"
}
response = requests.request("PATCH", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
{
  "status_code": 200,
  "success": true,
  "message": "Operation successful",
  "data": {
    "key": "value"
  },
  "error": {
    "code": "ERROR_CODE",
    "message": "An error occurred"
  }
}
{
  "status_code": 400,
  "success": false,
  "message": "Failed to update category",
  "error": {
    "code": "CATEGORY_UPDATE_ERROR",
    "message": "Failed to update category"
  }
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Delete a category

Delete a category by category id.

DELETE
/api/v1/categories/{cid}

Path Parameters

cidRequiredCid

Response Body

Successful Response

status_codeStatus Code

HTTP status code of the response.

Default: 200
successSuccess

Indicates whether the operation was successful.

Default: true
messageMessage

A message providing additional information about the operation.

Default: ""
dataobject | null | null
errorobject | null | null

Failed to delete category

Validation Error

detailDetail
curl -X DELETE "http://localhost:7242/api/v1/categories/string"
fetch("http://localhost:7242/api/v1/categories/string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "http://localhost:7242/api/v1/categories/string"

  req, _ := http.NewRequest("DELETE", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "http://localhost:7242/api/v1/categories/string"

response = requests.request("DELETE", url)

print(response.text)
{
  "status_code": 200,
  "success": true,
  "message": "Operation successful",
  "data": {
    "key": "value"
  },
  "error": {
    "code": "ERROR_CODE",
    "message": "An error occurred"
  }
}
{
  "status_code": 400,
  "success": false,
  "message": "Failed to delete category",
  "error": {
    "code": "CATEGORY_DELETE_ERROR",
    "message": "Failed to delete category"
  }
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}