Write a version
OpenAPI JSONconst url = 'https://api.eu.apigami.com/v1/apps/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/versions';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"base_version_id":null,"changes":[{"op":"write","path":"manifest.json","content":"{ \"openapi\": \"3.1.0\", … }"},{"op":"write","path":"main.ts","content":"export default { fetch(request, env) { … } }"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.eu.apigami.com/v1/apps/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/versions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "base_version_id": null, "changes": [ { "op": "write", "path": "manifest.json", "content": "{ \"openapi\": \"3.1.0\", … }" }, { "op": "write", "path": "main.ts", "content": "export default { fetch(request, env) { … } }" } ] }'Three ways in. changes: files written, replaced or deleted on base_version_id, or on nothing when it is null, and the version is whole at once (200). archive: a deposit for a zip of the project, and file: a deposit for one file on a base; both answer 201 with upload.url, a one-shot address to PUT the bytes to, holding its own authorisation. A version whose manifest is wrong is kept, validation.status: "invalid" and diagnostics naming the file, the field and the fix. The smallest complete project: https://www.apigami.com/docs/build-an-application/#starter-template-hello-world-without-a-browser
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
Example
{ "base_version_id": null, "changes": [ { "op": "write", "path": "manifest.json", "content": "{ \"openapi\": \"3.1.0\", … }" }, { "op": "write", "path": "main.ts", "content": "export default { fetch(request, env) { … } }" } ]}Responses
Section titled “Responses”The version, written from the changes.
Where one version stands. publish.next is the one sentence to act on.
object
ready once written, deployed, pending_review, rejected, among others.
object
object
A JSON pointer into the file.
The fix.
Present on a warning, which blocks nothing.
The info.version of its manifest.
Where its pages answer, from the slug of its manifest.
object
object
When one of its actions first answered below 500 on its own deployment, which publication requires.
object
object
Example
{ "validation": { "status": "valid", "diagnostics": [ { "level": "warning" } ] }}A deposit reserved: the version exists once its bytes are PUT to upload.url.
object
object
object
Example
{ "state": "reserved", "upload": { "method": "PUT" }}A change that cannot apply, such as a replace whose old_text appears zero times or more than once: nothing is written.
object
Present and true when the approval window is open and the user has not answered within 45 s.
Example
{ "error": "main.ts: `old_text` does not appear in this file. Nothing was written: correct this change and send them again."}Not an application of your team, or an unknown base version.
object
Present and true when the approval window is open and the user has not answered within 45 s.
Example
{ "error": "not found"}