- Changelog
- 1. Login
- 2. Get itineraries
- 3. Delete itinerary
- 4. Get user itinerary
- 5. Add destination
- 6. Delete destination
- 7. Update destination
- Glossary
Version | Date | Author | Description |
1.0 | 13-Mar-2023 | Justin Tan | Initial draft |
Authenticate the user with the system and obtain the auth_token
Method | URL |
POST
|
api/#/
|
Type | Params | Values |
HEAD |
api_key |
string |
POST |
username |
string |
POST
| password
| string
|
api_key
Must be sent with all client requests. The api_key helps the server to validate the request source.
Status | Response |
200
|
{
|
403
|
{"error":"API key is missing."}
|
400
|
{"error":"Please provide username."}
|
400
|
{"error":"Please provide password."}
|
401
|
{"error":"Invalid API key."}
|
401
|
{"error":"Incorrect username or password."}
|
500
|
{"error":"Something went wrong. Please try again later."}
|
Get all itineraries.
Method | URL |
GET
|
itineraries
|
Type | Params | Values |
HEAD
|
auth_key
|
string
|
auth_key
The auth_key
that was given in response to /api/#
Status | Response |
200
|
Response will be an object containing the list of itineraries (array).
Each item in the array has the following structure.
An example response is:-
|
401
|
{"error":"Invalid API key."}
|
500
|
{"error":"Something went wrong. Please try again later."}
|
Delete all itinerary items for the user id.
Method | URL |
DELETE
|
itinerary/{userId}
|
Type | Params | Values |
HEAD
|
auth_key
|
String
|
auth_key
The auth_key
that was given in response to /api/#
Status | Response |
204
|
Empty body |
401
|
{"error":"Invalid Auth key."}
|
500
|
{"error":"Something went wrong. Please try again later."}
|
Gets the itinerary for the specified userId.
Method | URL |
GET
|
itineraries/{userId}
|
Type | Params | Values |
HEAD
|
auth_key
|
string
|
auth_key
The auth_key
that was given in response to /api/#
Status | Response |
200
|
Response will be an object containing the itinerary with user_id = userId.
An example response is:-
|
401
|
{"error":"Invalid API key."}
|
500
|
{"error":"Something went wrong. Please try again later."}
|
Add an item to the itinerary for the specified userId.
Method | URL |
POST
|
itineraries/{userId}
|
Type | Params | Values |
HEAD
|
auth_key
|
string
|
auth_key
The auth_key
that was given in response to /api/#
destinationCity
The destination city to be deleted.
Type | Content |
application/json
|
Content will be an object containing the new itinerary item, sans userId and id.
|
Status | Response |
200
|
The ID of the created itinerary.
|
401
|
{"error":"Invalid API key."}
|
500
|
{"error":"Something went wrong. Please try again later."}
|
Delete itinerary record with the itineraryId
for the specified userId.
Method | URL |
DELETE
|
itineraries/{userId}/{itineraryId}
|
Type | Params | Values |
HEAD
|
auth_key
|
string
|
auth_key
The auth_key
that was given in response to /api/#
destinationCity
The destination city to be deleted.
Status | Response |
204
|
Empty Body |
401
|
{"error":"Invalid API key."}
|
500
|
{"error":"Something went wrong. Please try again later."}
|
Update itinerary records with the itineraryId
for the specified userId.
Method | URL |
PUT
|
itineraries/{userId}/{itineraryId}
|
Type | Params | Values |
HEAD
|
auth_key
|
string
|
auth_key
The auth_key
that was given in response to /api/#
Type | Content |
application/json
|
Content will be an object containing the updated itinerary item, sans userId and id.
|
Status | Response |
200
|
The ID of the updated itinerary.
|
401
|
{"error":"Invalid API key."}
|
500
|
{"error":"Something went wrong. Please try again later."}
|
- Client - Client application.
- Status - HTTP status code of response.
- All the possible responses are listed under ‘Responses’ for each method. Only one of them is issued per request server.
- All response are in JSON format.
- All request parameters are mandatory unless explicitly marked as
[optional]
- The type of values accepted for a request parameter are shown the the values column like this
[10|<any number>]
.The|
symbol means OR. If the parameter is[optional]
, the default value is shown in blue bold text, as10
is written in[10|<any number>]
.
All status codes are standard HTTP status codes. The below ones are used in this API.
2XX -
Success of some kind
4XX -
Error occurred in client’s part
5XX -
Error occurred in server’s part
Status Code | Description |
200
|
OK
|
201
|
Created
|
202
|
Accepted (Request accepted, and queued for execution)
|
400
|
Bad request
|
401
|
Authentication failure
|
403
|
Forbidden
|
404
|
Resource not found
|
405
|
Method Not Allowed
|
409
|
Conflict
|
412
|
Precondition Failed
|
413
|
Request Entity Too Large
|
500
|
Internal Server Error
|
501
|
Not Implemented
|
503
|
Service Unavailable
|