STARTHERE : General Guide


API BASE URL
https://api.deltasystematics360.com

Passing request paramaters/values

FOR POST/PATCH/DELETE and PUT REQUESTS - use JSON object e.g:

{
	parameter1: 'value',
	parameter2: 'value'
}

FOR GET REQUESTS, use URL query strings e.g:

http://apiurl.ext/endpoint?paramter1=value1&parameter2=value2

Authenticating REQUESTS

Include authorization header in calls to all endpoints marked:

---AUTHENTICATION REQUIRED---

If no token is supplied or provided token is invalid/expired, HTTP 400 error (status = fail) will be returned with code UNAUTHORISED

authorization: 'Bearer authenticated_admin_token'

API Responses (success, fail and error)

Success RESPONSE format - HTTP status code 2xx

{
	status: 'success',
	data: JSON payload of operation result
}

Errors - HTTP status codes 400 and 500

- `400` if any of the data was invalid. (status = fail)
- `500` with a database/server error (status = error)

Error RESPONSE format

{
	'status' : 'error|fail',
	'message': 'description of error',
	'code'  : 'error code (optional)'
}

POST /hospital/login

Login hospital with login and password

REQUEST format

{
	login: 'username',
	password: 'password',
	return_refresh_token: true|false (optional)
}

RESPONSE format

{
	status: 'success',
	data: {
		token: 'token for subsequent requests'
	}
}

PATCH /hospital/password

Update/change admin password

---AUTHENTICATION REQUIRED---

REQUEST format

{
	old_password: 'old password',
	new_password: 'new password',
	return_refresh_token: true|false (optional)
}

RESPONSE format

{
	status: 'success',
	data: {
		token: 'new token'
	}
}

GET /hospital/info

Get information for currently signed in hospital

---AUTHENTICATION REQUIRED---

REQUEST format

No parameter is required

RESPONSE format

{
	status: 'success',
	data: 
	{
		id: number,
		name: string,
		login: string,
		phones: [phone1, phone2, phone3],
		address: string,
		location: string,
		latitude: number (floating point/decimal/long),
		longitude: number (floating point/decimal/long),
		categories: [category1_title, category2_title, ...],
		work_hours: {
			mon: {open: string, close: string},
			tue: {open: string, close: string},
			wed: {open: string, close: string},
			thu: {open: string, close: string},
			fri: {open: string, close: string},
			sat: {open: string, close: string},
			sun: {open: string, close: string}
		},
		logo: url,
		banner: url,
		email: string,
		website: string,
		description: string
	}
}

PATCH /hospitals/info

Update info for currently logged in hospital

---AUTHENTICATION REQUIRED---

REQUEST format

{
	id: int,
	name: string,
	phones: [phone1, phone2, phone3],
	address: string,
	location: string,
	latitude: number (floating point/decimal/long),
	longitude: number (floating point/decimal/long),
	categories: [category1_id, category2_id, ...],
	work_hours: {
		mon: {open: string, close: string},
		tue: {open: string, close: string},
		wed: {open: string, close: string},
		thu: {open: string, close: string},
		fri: {open: string, close: string},
		sat: {open: string, close: string},
		sun: {open: string, close: string}
	},
	logo: file (optional),
	banner: file (optional),
	email: string (optional),
	website: string (optional),
	description: string (optional)
}

RESPONSE format

{
	status: 'success',
	data: 'Update successful'
}