엔드포인트
앱 게시
Publish 버튼이 하는 것처럼 저장된 앱을 온라인에 올려요.
POST
https://www.setherion.com/api/v1/projects/{id}/publish요금제: 모든 요금제
저장된 그대로 앱을 온라인에 올려요. 에디터의 Publish 버튼과 같은 단계를 거쳐요. 전에 게시한 앱은 주소가 그대로 유지되고, 처음 게시하는 앱은 앱 이름으로 만든 주소를 setherion.app에서 받아요.
게시에는 크레딧이 들지 않아요. 앱을 수정할 수 있는 권한이 있어야 해요. API로는 계정당 하루 100번까지만 게시할 수 있어요. 직접 작업하는 사람은 이 한도에 닿지 않아요. 에디터의 버튼에는 이런 한도가 없어요.
요청
본문은 필요 없어요.
bash
curl -X POST https://www.setherion.com/api/v1/projects/7c1e4a52-9b0d-4f3e-8a61-2d5f0c9e7b14/publish \
-H "Authorization: Bearer $SETHERION_API_KEY"응답
json
{ "ok": true, "url": "https://coffee-shop.setherion.app", "ready": true }| 필드 | 타입 | 의미 |
|---|---|---|
ok | boolean | 앱이 게시되면 true예요. |
url | string | 앱이 온라인에 있는 주소예요. |
ready | boolean | 주소를 아직 준비하는 중이면 false예요. 1분이나 2분 안에 작동해요. |
같은 저장본을 두 번 게시해도 안전해요. 두 번째 호출도 같은 주소로 응답해요.
수정한 다음 게시하기
게시되는 것은 저장된 내용이고, 수정은 끝나면 저장돼요. 그래서 앱 수정 다음에 게시를 호출하면 변경 사항이 온라인에 올라가요:
js
const base = 'https://www.setherion.com/api/v1/projects'
const headers = {
Authorization: `Bearer ${process.env.SETHERION_API_KEY}`,
'Content-Type': 'application/json',
}
const edit = await fetch(`${base}/${appId}/edit`, {
method: 'POST',
headers,
body: JSON.stringify({ prompt: 'Add a contact form' }),
}).then(r => r.json())
if (edit.ok) {
const live = await fetch(`${base}/${appId}/publish`, { method: 'POST', headers }).then(r => r.json())
console.log(live.url)
}오류
| 상태 | 발생하는 경우 |
|---|---|
400 | 앱 코드에 API 키 같은 시크릿이 들어 있어서 게시되지 않았어요. 오류 메시지에 그 위치가 나와요. |
401 | 키가 없거나, 잘못되었거나, 취소되었어요. |
404 | 그런 앱이 없거나, 내 키로는 그 앱을 수정할 수 없어요. |
409 | 앱에 아직 코드가 없거나, 필요한 주소를 쓸 수 없거나, 내 도메인에 올릴 수 없는 비공개 앱이에요. 어느 경우인지는 오류 메시지에 나와요. |
429 | 오늘 API로 100번 게시했어요. 횟수는 내일 초기화돼요. |
502 | 저희 쪽에서 게시에 실패했거나 호스트의 빌드가 실패했어요. 다시 시도하세요. |
503 | 게시를 잠시 사용할 수 없어요. 1분 뒤에 다시 시도하세요. |
정확한 문장
| 상태 | error |
|---|---|
400 | Publishing would put a secret key on the open internet: ... 뒤에 시크릿의 종류, 파일과 줄, 대신 해야 할 일이 이어져요. |
404 | No such app on this account. |
409 | This app has no code yet. Build it in Setherion first. |
409 | The address coffee-shop.setherion.app belongs to another app. Choose a different one. |
409 | Could not find a free address for this app. Rename it and publish again. |
409 | This app is private, and a private app can only be published on its setherion.app address. To use a domain of your own, make it public first. Otherwise try again in a moment. Nothing was published. |
429 | That is 100 publishes through the API today. The count resets tomorrow. |
502 | The build failed on the host, so this version is not online. Publish again, and if it fails again, ask for a fix in the editor. |
502 | The build was cancelled on the host, so this version is not online. Publish again. |
503 | Publishing is briefly unavailable. Try again in a minute. |
이 페이지가 도움이 됐나요?
