Base API
/api
Authentication
Use either of the following
Field | Description | Type |
---|---|---|
api_key | API Key of the upstream | GET Parameter |
X-API-KEY | API Key of the upstream | Header |
Example Request
curl 'https://hamroblog.live/api?api_key=XXX'
Response:
API key is valid
{'message':'OK','status':200}
API key is not passed
{'error': 'API key is required','status':400}
Incorrect API key passed
{'error': 'Invalid API key provided','status':404}
Get Domains
/api/domains
get a json list of domains associated with an upstream
Example Request
curl 'https://hamroblog.live/api/domains'
Response:
['domain1.com','domain2.com']
Add Domain
/api/domains
add a domain to a upstream
Parameters
Field | Description | Format |
---|---|---|
domain | Domain name to be added to a upstream | JSON Payload |
Example Request
curl - X POST 'https://hamroblog.live/api/domains' -H "Content-Type: application/json" -d '{"domain": "domain.com"}'
Response:
Successfully added the domain
{'message':'added successfully','status':200}
Domain not passed in request body
{'error': 'Domain is required','status':400}
Domain already exists in the upstream
{'error': 'Domain already exists','status':409}
Provided domain doesn't exist
{'error': 'Invalid Domain Name','status':400}
Domain has no cname records set
{'error': 'No CNAME record found in the domain. Please add and try again','status':400}
The required cname record to xxx.hamroblog.live is not set
{'error': 'Required CNAME is not set. Please try again later.','status':400}
Delete Domain
/api/domains
delete a domain from a upstream
Parameters
Field | Description | Format |
---|---|---|
domain | Domain name to be removed from a upstream | JSON Payload |
Example Request
curl - X DELETE 'https://hamroblog.live/api/domains' -H "Content-Type: application/json" -d '{"domain": "domain.com"}'
Response:
Successfully deleted the domain
{'message':'Domain deleted','status':200}
Domain not passed in request body
{'error': 'Domain is required','status':400}
Domain doesn't exists in the upstream
{'error': 'Domain not found','status':404}