Robot Dokümantasyonu

Kategoriler API

Robot hedeflerini düzenlemek ve sınıflandırmak için hedef kategorilerini yönetin.

Kategorilerin listesini alma

Robot için yapılandırılmış tüm kategorileri döndürür.

GET
/categories

Authorization

x-api-key<token>

Robotun projesinde Robot Gateway Client rolü olan bir istemcinin API anahtarı

In: header

Response Body

Başarılı yanıt

responseRequiredResponse Get Categories Api V1 Categories Get
curl -X GET "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories" \
  -H "x-api-key: <token>"
fetch("https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories", {
  headers: {
    "x-api-key": "<token>"
  }
})
package main

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

func main() {
  url := "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories"

  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("x-api-key", "<token>")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

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

url = "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories"

response = requests.request("GET", url, headers = {
  "x-api-key": "<token>"
})

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

Robota yeni kategori ekleme

Robotun yapılandırmasına yeni bir kategori ekler.

POST
/categories

Authorization

x-api-key<token>

Robotun projesinde Robot Gateway Client rolü olan bir istemcinin API anahtarı

In: header

Request Body

application/jsonRequired
imagestring | null | null
labelLabel

Kategori etiketi JSON'u.

Default: "{}"
cidstring | null | null

Response Body

Başarılı yanıt

status_codeStatus Code

Yanıtın HTTP durum kodu.

Default: 200
successSuccess

İşlemin başarılı olup olmadığını belirtir.

Default: true
messageMessage

İşlem hakkında ek bilgi veren mesaj.

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

Kategori eklenemedi

Doğrulama hatası

detailDetail
curl -X POST "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories" \
  -H "x-api-key: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "",
    "label": "{\"name\":\"Beverages\"}",
    "cid": "1"
  }'
const body = JSON.stringify({
  "image": "",
  "label": "{\"name\":\"Beverages\"}",
  "cid": "1"
})

fetch("https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories", {
  headers: {
    "x-api-key": "<token>"
  },
  body
})
package main

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

func main() {
  url := "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories"
  body := strings.NewReader(`{
    "image": "",
    "label": "{\"name\":\"Beverages\"}",
    "cid": "1"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("x-api-key", "<token>")
  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 = "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories"
body = {
  "image": "",
  "label": "{\"name\":\"Beverages\"}",
  "cid": "1"
}
response = requests.request("POST", url, json = body, headers = {
  "x-api-key": "<token>",
  "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"
    }
  ]
}

Bir kategoriyi ID'ye göre alma

Bir kategoriyi kategori ID'sine göre döndürür.

GET
/categories/{cid}

Authorization

x-api-key<token>

Robotun projesinde Robot Gateway Client rolü olan bir istemcinin API anahtarı

In: header

Path Parameters

cidRequiredCid

Response Body

Başarılı yanıt

imagestring | null | null
labelLabel

Kategori etiketi JSON'u.

Default: "{}"
cidstring | null | null

Kategori bulunamadı.

Doğrulama hatası

detailDetail
curl -X GET "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string" \
  -H "x-api-key: <token>"
fetch("https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string", {
  headers: {
    "x-api-key": "<token>"
  }
})
package main

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

func main() {
  url := "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string"

  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("x-api-key", "<token>")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

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

url = "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string"

response = requests.request("GET", url, headers = {
  "x-api-key": "<token>"
})

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"
    }
  ]
}

Kategori güncelleme

Kategori alanlarını kategori ID'sine göre günceller.

PATCH
/categories/{cid}

Authorization

x-api-key<token>

Robotun projesinde Robot Gateway Client rolü olan bir istemcinin API anahtarı

In: header

Request Body

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

Path Parameters

cidRequiredCid

Response Body

Başarılı yanıt

status_codeStatus Code

Yanıtın HTTP durum kodu.

Default: 200
successSuccess

İşlemin başarılı olup olmadığını belirtir.

Default: true
messageMessage

İşlem hakkında ek bilgi veren mesaj.

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

Kategori güncellenemedi

Doğrulama hatası

detailDetail
curl -X PATCH "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string" \
  -H "x-api-key: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "",
    "label": "{\"name\":\"Beverages\"}"
  }'
const body = JSON.stringify({
  "image": "",
  "label": "{\"name\":\"Beverages\"}"
})

fetch("https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string", {
  headers: {
    "x-api-key": "<token>"
  },
  body
})
package main

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

func main() {
  url := "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string"
  body := strings.NewReader(`{
    "image": "",
    "label": "{\"name\":\"Beverages\"}"
  }`)
  req, _ := http.NewRequest("PATCH", url, body)
  req.Header.Add("x-api-key", "<token>")
  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 = "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string"
body = {
  "image": "",
  "label": "{\"name\":\"Beverages\"}"
}
response = requests.request("PATCH", url, json = body, headers = {
  "x-api-key": "<token>",
  "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"
    }
  ]
}

Kategori silme

Bir kategoriyi kategori ID'sine göre siler.

DELETE
/categories/{cid}

Authorization

x-api-key<token>

Robotun projesinde Robot Gateway Client rolü olan bir istemcinin API anahtarı

In: header

Path Parameters

cidRequiredCid

Response Body

Başarılı yanıt

status_codeStatus Code

Yanıtın HTTP durum kodu.

Default: 200
successSuccess

İşlemin başarılı olup olmadığını belirtir.

Default: true
messageMessage

İşlem hakkında ek bilgi veren mesaj.

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

Kategori silinemedi

Doğrulama hatası

detailDetail
curl -X DELETE "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string" \
  -H "x-api-key: <token>"
fetch("https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string", {
  headers: {
    "x-api-key": "<token>"
  }
})
package main

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

func main() {
  url := "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string"

  req, _ := http.NewRequest("DELETE", url, nil)
  req.Header.Add("x-api-key", "<token>")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

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

url = "https://robots.saharobotik.com/api/v1/YOUR_ROBOT_ID/robot/categories/string"

response = requests.request("DELETE", url, headers = {
  "x-api-key": "<token>"
})

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"
    }
  ]
}