pocketdb api
1.0.0
pocketdb.js 용 수공 된 REST API - Telegra.ph 용 포켓 데이터베이스 래퍼
// GET https://pocketdb-api.vercel.app/get?token=my-token&key=users
{
"success" : true ,
"result" : {
"list" : [ "users" ] ,
"data" : [ {
"name" : "John Doe" ,
"age" : 24 ,
"email" : "[email protected]"
} ]
} ,
"request" : {
"endpoint" : "/get" ,
"token" : "my-token" ,
"key" : "users"
}
} pocketdb-api /web/index.html에서 온라인 사용을 제공합니다

| 엔드 포인트 | 방법 | 매개 변수 |
|---|---|---|
/set | 우편 | 키, *토큰 |
/get | 얻다 | 열쇠, 토큰 |
* - 선택 사항
/set POST https://pocketdb-api.vercel.app/set?token=...&key=...
토큰과 함께 사용 /set 때 요청 본문에 제공된 JSON 컨텐츠를 사용하여 지정된 키와 관련된 데이터를 수정하거나 생성합니다.
await fetch ( "https://pocketdb-api.vercel.app/set?token=...&key=users" , {
method : "post" ,
body : JSON . stringify ( {
name : "John Doe" ,
age : 24 ,
email : "[email protected]"
} )
} )출력은 다음과 같습니다.
{
"success" : true ,
"result" : {
"list" : [ "users" ]
} ,
"request" : {
"endpoint" : "/set" ,
"key" : "users" ,
"value" : {
"name" : "John Doe" ,
"age" : 24 ,
"email" : "[email protected]"
} ,
"token" : "..."
}
} /set POST https://pocketdb-api.vercel.app/set?&key=...
토큰이없는 /set 사용하는 경우 요청 본문에 제공된 JSON 컨텐츠를 사용하여 새 데이터베이스를 시작하고 제공된 키와 관련된 데이터를 삽입합니다.
await fetch ( "https://pocketdb-api.vercel.app/set?key=users" , {
method : "post" ,
body : JSON . stringify ( {
name : "John Doe" ,
age : 24 ,
email : "[email protected]"
} )
} )출력은 다음과 같습니다.
{
"success" : true ,
"result" : {
"list" : [ "users" ] ,
"token" : "..."
} ,
"request" : {
"endpoint" : "/set" ,
"key" : "users" ,
"value" : {
"name" : "John Doe" ,
"age" : 24 ,
"email" : "[email protected]"
}
}
} /get GET https://pocketdb-api.vercel.app/get?token=...&key=...
이 엔드 포인트는 제공된 키와 관련된 데이터 컨텐츠를 검색하고 JSON 형식으로 반환합니다.
await fetch ( "https://pocketdb-api.vercel.app/get?token=...&key=users" )출력은 다음과 같습니다.
{
"success" : true ,
"result" : {
"list" : [ "users" ] ,
"data" : {
"name" : "John Doe" ,
"age" : 24 ,
"email" : "[email protected]"
}
} ,
"request" : {
"endpoint" : "/get" ,
"key" : "users" ,
"token" : "..."
}
} | 엔드 포인트 | 오류 | 메시지 | 원인 |
|---|---|---|---|
/set | INCOMPLETE_PARAM | 불완전한 매개 변수. 자세한 내용은 문서 https://github.com/creuserr/pocketdb-api/blob/blob/blob/blob/blob/blob/blob/readme.md#documentation을 참조하십시오. | 매개 변수 key 필요합니다. JSON으로서의 몸뿐만 아니라. |
/set | INVALID_BODY | 신체가 제대로 인코딩되지 않았습니다. 자세한 내용은 문서 https://github.com/creuserr/pocketdb-api/blob/blob/blob/blob/blob/blob/blob/readme.md#documentation을 참조하십시오. | 신체는 유효한 줄무늬 JSON이어야합니다. 문자열이 예상됩니다 |
/set | INVALID_METHOD | 게시물은 엔드 포인트 /세트에 허용되는 유일한 방법입니다. | 엔드 포인트 /set POST 메소드 만 허용합니다. |
/get | INCOMPLETE_PARAM | 불완전한 매개 변수. 자세한 내용은 문서 https://github.com/creuserr/pocketdb-api/blob/blob/blob/blob/blob/blob/blob/readme.md#documentation을 참조하십시오. | 매개 변수 key 및 token 필요합니다. |
/get | INVALID_METHOD | get은 엔드 포인트 /get에 대해 허용되는 유일한 방법입니다. | 엔드 포인트 /get GET 메소드 만 허용합니다. |
/set 또는 /get | INTERNAL_ERROR | 오류 메시지 | 이 오류는 상승 오류에 따라 다를 수 있습니다. 가능한 원인으로는 유효하지 않은 JSON, 연결 고장, 데이터베이스를 찾을 수 없음 (토큰 존재하지 않음) 또는 키를 찾을 수 없습니다. |
// Example Error:
// POST https://pocketdb-api.vercel.app/get?token=...&key=...
{
"success" : false ,
"error" : "INVALID_METHOD" ,
"message" : "GET is the only method accepted for the endpoint /get" ,
"request" : {
"token" : "..." ,
"key" : "..." ,
"endpoint" : "/get"
}
}