메인 콘텐츠로 건너뛰기
POST
/
objs
/
query
객체 쿼리
curl --request POST \
  --url https://api.example.com/objs/query \
  --header 'Content-Type: application/json' \
  --data '
{
  "project_id": "<string>",
  "filter": {
    "latest_only": true,
    "object_ids": [
      "my_favorite_model"
    ]
  },
  "include_storage_size": false,
  "include_tags_and_aliases": false,
  "limit": 100,
  "metadata_only": false,
  "offset": 0,
  "sort_by": [
    {
      "direction": "desc",
      "field": "created_at"
    }
  ]
}
'
import requests

url = "https://api.example.com/objs/query"

payload = {
    "project_id": "<string>",
    "filter": {
        "latest_only": True,
        "object_ids": ["my_favorite_model"]
    },
    "include_storage_size": False,
    "include_tags_and_aliases": False,
    "limit": 100,
    "metadata_only": False,
    "offset": 0,
    "sort_by": [
        {
            "direction": "desc",
            "field": "created_at"
        }
    ]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    project_id: '<string>',
    filter: {latest_only: true, object_ids: ['my_favorite_model']},
    include_storage_size: false,
    include_tags_and_aliases: false,
    limit: 100,
    metadata_only: false,
    offset: 0,
    sort_by: [{direction: 'desc', field: 'created_at'}]
  })
};

fetch('https://api.example.com/objs/query', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.example.com/objs/query",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'project_id' => '<string>',
    'filter' => [
        'latest_only' => true,
        'object_ids' => [
                'my_favorite_model'
        ]
    ],
    'include_storage_size' => false,
    'include_tags_and_aliases' => false,
    'limit' => 100,
    'metadata_only' => false,
    'offset' => 0,
    'sort_by' => [
        [
                'direction' => 'desc',
                'field' => 'created_at'
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

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

func main() {

	url := "https://api.example.com/objs/query"

	payload := strings.NewReader("{\n  \"project_id\": \"<string>\",\n  \"filter\": {\n    \"latest_only\": true,\n    \"object_ids\": [\n      \"my_favorite_model\"\n    ]\n  },\n  \"include_storage_size\": false,\n  \"include_tags_and_aliases\": false,\n  \"limit\": 100,\n  \"metadata_only\": false,\n  \"offset\": 0,\n  \"sort_by\": [\n    {\n      \"direction\": \"desc\",\n      \"field\": \"created_at\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/objs/query")
  .header("Content-Type", "application/json")
  .body("{\n  \"project_id\": \"<string>\",\n  \"filter\": {\n    \"latest_only\": true,\n    \"object_ids\": [\n      \"my_favorite_model\"\n    ]\n  },\n  \"include_storage_size\": false,\n  \"include_tags_and_aliases\": false,\n  \"limit\": 100,\n  \"metadata_only\": false,\n  \"offset\": 0,\n  \"sort_by\": [\n    {\n      \"direction\": \"desc\",\n      \"field\": \"created_at\"\n    }\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/objs/query")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"project_id\": \"<string>\",\n  \"filter\": {\n    \"latest_only\": true,\n    \"object_ids\": [\n      \"my_favorite_model\"\n    ]\n  },\n  \"include_storage_size\": false,\n  \"include_tags_and_aliases\": false,\n  \"limit\": 100,\n  \"metadata_only\": false,\n  \"offset\": 0,\n  \"sort_by\": [\n    {\n      \"direction\": \"desc\",\n      \"field\": \"created_at\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "objs": [
    {
      "base_object_class": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "digest": "<string>",
      "is_latest": 123,
      "kind": "<string>",
      "object_id": "<string>",
      "project_id": "<string>",
      "val": "<unknown>",
      "version_index": 123,
      "aliases": [
        "<string>"
      ],
      "deleted_at": "2023-11-07T05:31:56Z",
      "leaf_object_class": "<string>",
      "size_bytes": 123,
      "tags": [
        "<string>"
      ],
      "wb_user_id": "<string>"
    }
  ]
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

본문

application/json
project_id
string
필수

쿼리할 프로젝트의 ID

예시:

"user/project"

filter
ObjectVersionFilter · object | null

쿼리의 필터 기준입니다. ObjectVersionFilter를 참조하세요.

예시:
{
  "latest_only": true,
  "object_ids": ["my_favorite_model"]
}
include_storage_size
boolean | null
기본값:false

true이면 size_bytes 열이 반환됩니다.

include_tags_and_aliases
boolean | null
기본값:false

true이면 태그와 별칭을 가져와 응답에 포함합니다.

limit
integer | null

반환할 결과의 최대 개수

예시:

100

metadata_only
boolean | null
기본값:false

true이면 val 열은 데이터베이스에서 읽지 않으며 비어 있게 됩니다. 그 외의 모든 필드는 반환됩니다.

offset
integer | null

반환하기 전에 건너뛸 결과 수

예시:

0

sort_by
SortBy · object[] | null

쿼리 결과의 정렬 기준입니다. 현재는 'object_id'와 'created_at'만 지원합니다.

예시:
[
  {
    "direction": "desc",
    "field": "created_at"
  }
]

응답

성공 응답

objs
ObjSchema · object[]
필수