~ekez/negativefour

ref: a3ba218efef2773e5826b94d9ca3c096795b3ddc negativefour/docs/serve-api.md -rw-r--r-- 1.6 KiB
a3ba218eZeke Medley Fix race condition between apache restart and status check 8 months ago

#Serve API

API documentation for serve.negativefour.com.

All requests begin in the form:

{
	token: <JWT token signed with internal api key>
}

The token signature is then checked. If the signature validates alright the token is unpacked and its contents are sent to the API endpoints.

This is a long winded way of saying that the API paramaters shown below must match the contents of the signed token you send.

#/deploy

POST JSON body params:

{
	name: <name of the webpage>,
	repo: <link to git repo containing static webpage>,
}

POST JSON response:

{
	jobID: <id for querying the status of the deploy job>
}

An invalid request will result in a JSON reponse containing an error field and the HTTP status code will be set appropriately.

{
	error: <error message for the invalid request>
}

#/delete

POST JSON body params:

{
	name: <name of the webpage>,
	user: <user email that controls name>
}

POST JSON response:

{
	jobID: <id for querying the status of the undeploy job>
}

#/status

GET JSON body params:

{
	jobID: <previously provided jobID>,
}

GET JSON response:

{
	stdout: <standard out from job so far>,
	stderr: <standard err from job so far>,
	exitCode: <present if job has exited - exit code of deploy script>,
	serverError: <present if there was a server starting the script - contains error message>
}

An invalid request will result in a JSON reponse containing an error field and the HTTP status code will be set appropriately.

{
	error: <error message for the invalid request>
}