Implement new API
All API calls require the passing of a secret that authenticates them. For the test server, this secret is hardcoded.
## API versioning
The API endpoints should be versioned, starting with the current version at
/v1. All locations, below, should be prefixed with the version identifier.
Check if the domain is available. Returns a JSON object with a boolean status.
Where the following known values for
domain returns the following responses:
- error.gent: triggers the 503 service unavailable error.
On error, the server should return a valid error message.
- 503: Service unavailable. The domain check/registration service is unavailable.
Asks for the passed domain to be registered and for an Indie Site to be set up at it.
domain=<domain>: the domain to register
callback=<callback-url>: the callback URL to inform when the domain is ready
- Registration request received and process successfully started: 201 Created
- Domain not available: 409 Conflict
- Domain registration service is unavailable: 503 Service Unavailable
On successful registration of the domain and creation of the Indie Site, the Magic Website Factory carries out a PATCH request to the
callback URL passed in the Site service’s POST method with the following arguments:
<callback-url>/site/<domain>: domain to update the status for
?status=<code>: 201 = created, 409 = conflict (domain not available), 500 = internal server error (the site setup process failed and will not be retried)
The Magic Website Factory expects the following responses to its callback request:
- 200 OK: Response successfully received
- Error code (depending on error): callback failed. Log the error and queue the callback to be tried again (exponential falloff).