프로필 수정
curl --request PUT \
--url https://sajuapi.dev/v1/profiles/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"birth_year": 123,
"birth_month": 123,
"birth_day": 123,
"birth_hour": 123,
"gender": "<string>"
}
'import requests
url = "https://sajuapi.dev/v1/profiles/{id}"
payload = {
"name": "<string>",
"birth_year": 123,
"birth_month": 123,
"birth_day": 123,
"birth_hour": 123,
"gender": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
birth_year: 123,
birth_month: 123,
birth_day: 123,
birth_hour: 123,
gender: '<string>'
})
};
fetch('https://sajuapi.dev/v1/profiles/{id}', 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://sajuapi.dev/v1/profiles/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'birth_year' => 123,
'birth_month' => 123,
'birth_day' => 123,
'birth_hour' => 123,
'gender' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://sajuapi.dev/v1/profiles/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.put("https://sajuapi.dev/v1/profiles/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/profiles/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body프로필
프로필 수정
PUT
/
v1
/
profiles
/
{id}
프로필 수정
curl --request PUT \
--url https://sajuapi.dev/v1/profiles/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"birth_year": 123,
"birth_month": 123,
"birth_day": 123,
"birth_hour": 123,
"gender": "<string>"
}
'import requests
url = "https://sajuapi.dev/v1/profiles/{id}"
payload = {
"name": "<string>",
"birth_year": 123,
"birth_month": 123,
"birth_day": 123,
"birth_hour": 123,
"gender": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
birth_year: 123,
birth_month: 123,
birth_day: 123,
birth_hour: 123,
gender: '<string>'
})
};
fetch('https://sajuapi.dev/v1/profiles/{id}', 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://sajuapi.dev/v1/profiles/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'birth_year' => 123,
'birth_month' => 123,
'birth_day' => 123,
'birth_hour' => 123,
'gender' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://sajuapi.dev/v1/profiles/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.put("https://sajuapi.dev/v1/profiles/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sajuapi.dev/v1/profiles/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"birth_year\": 123,\n \"birth_month\": 123,\n \"birth_day\": 123,\n \"birth_hour\": 123,\n \"gender\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyv1 Enterprise API (Coming Soon)이 엔드포인트는 Enterprise 버전에서 제공될 예정입니다.
현재는 v0 API를 사용하세요.
생년월일이 변경되면 사주팔자가 자동으로 재계산됩니다.
Path 파라미터
string
required
수정할 프로필의 ID입니다.
prf_ 접두사로 시작합니다.Request Body 파라미터
string
사용자 이름입니다. 최대 길이는 20자입니다. 이 값은 암호화되어 저장됩니다.
integer
출생 연도입니다. 1900에서 2100 사이의 값이어야 합니다.
integer
출생 월입니다. 1에서 12 사이의 값이어야 합니다.
integer
출생 일입니다. 1에서 31 사이의 값이어야 합니다.
integer
출생 시입니다. 0에서 23 사이의 값이어야 합니다.
null로 설정하면 시주 정보가 삭제됩니다.string
성별입니다.
male 또는 female 중 하나입니다.Response
성공
프로필 수정에 성공하면 수정된 Profile 객체가 반환됩니다. 민감한 정보는 마스킹되어 반환됩니다.실패
| 상태 코드 | 에러 타입 | 설명 |
|---|---|---|
| 400 | validation_error | 요청 데이터가 유효하지 않음 |
| 401 | authentication_error | API 키가 유효하지 않음 |
| 404 | not_found | 프로필을 찾을 수 없음 |
| 429 | rate_limited | 요청 한도 초과 |
요청 예시
curl -X PUT https://api.sajuapi.dev/v1/profiles/prf_abc123def456 \
-H "X-API-Key: bs_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"name": "김영희",
"birth_hour": 10
}'
const response = await fetch(
'https://api.sajuapi.dev/v1/profiles/prf_abc123def456',
{
method: 'PUT',
headers: {
'X-API-Key': 'bs_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '김영희',
birth_hour: 10
})
}
);
const profile = await response.json();
import requests
response = requests.put(
'https://api.sajuapi.dev/v1/profiles/prf_abc123def456',
headers={'X-API-Key': 'bs_live_xxx'},
json={
'name': '김영희',
'birth_hour': 10
}
)
profile = response.json()
응답 예시
{
"id": "prf_abc123def456",
"external_id": "user_12345",
"name": "김**",
"birth_year": "19**",
"gender": "male",
"day_master": "병화",
"day_master_element": "fire",
"weakest_element": "water",
"created_at": "2025-01-15T09:00:00Z",
"updated_at": "2025-01-16T14:30:00Z"
}
부분 업데이트
요청 본문에 포함된 필드만 업데이트됩니다. 포함되지 않은 필드는 기존 값을 유지합니다.// 이름만 변경
await fetch('/v1/profiles/prf_abc123def456', {
method: 'PUT',
headers: {
'X-API-Key': 'bs_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({ name: '새이름' })
});
// 시주 정보 삭제
await fetch('/v1/profiles/prf_abc123def456', {
method: 'PUT',
headers: {
'X-API-Key': 'bs_live_xxx',
'Content-Type': 'application/json'
},
body: JSON.stringify({ birth_hour: null })
});
⌘I