Robot Dokümantasyonu

Ağ Geçidi API

API anahtarınızla Robot Ağ Geçidi üzerinden erişebileceğiniz robotları listeleyin.

API anahtarınızla erişebileceğiniz robotları listeleyin

Bu API anahtarıyla ağ geçidi üzerinden istek gönderebileceğiniz robotları döndürür: anahtarın ait olduğu API istemcisinin Robot Gateway Client rolüne sahip olduğu projelerdeki, aktive edilmiş ve ağ geçidinin ağına bağlı robotlar. Bir robotun robot_id değerini Robot API temel URL'sinde kullanın. Anahtarla erişilebilen robot yoksa robots boş liste döner.

GET
/robots

Authorization

x-api-key<token>

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

In: header

Response Body

Bu API anahtarıyla erişilebilen robotlar, robot ID'sine göre sıralı

robotsRequiredarray<object>

x-api-key başlığı eksik veya anahtar geçersiz

statusCodeinteger

HTTP durum kodu

messagestring

Hata mesajı

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

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

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

  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/robots"

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

print(response.text)
{
  "robots": [
    {
      "robot_id": "SR10S1",
      "project_id": 42,
      "model": "S1",
      "online": true
    }
  ]
}
{
  "statusCode": 401,
  "message": "Unauthorized request"
}