Schema
URL base
The API is available at https://api.hernandez-julio.com/. Responses are sent as JSON.
Version
All requests receive the v1 version of the API.
Specs
The official specs can be found at chinook-webapi. To start testing, just import this document into a Postman project.
HTTP Verbs
This API uses HTTP verbs appropriate to each action.
| Verb | Description |
|---|---|
| GET | Retrieving resources. |
| POST | Creating resources. |
| PUT | Updating resources. |
| DELETE | Deleting resources. |
Error messages
If an error occurs, whether on the server or client side, the error message(s) will be returned in an errors array. For example:
400 Bad Request
{
"probable_culprit": ["Malformed Syntax","Missing Required Data","Invalid Data Types or Values","Encoding Issues","Invalid Page"]
}
We use conventional HTTP response codes to indicate the success or failure of an API request.
In general, codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, etc.). Codes in the 5xx range indicate an error with our servers.
| Common Status Codes | Description |
|---|---|
| 200 - OK | Everything worked as expected |
| 201 - Created | A new record was added to the database |
| 400 - Bad Request | The request was unacceptable, often due to missing a required parameter |
| 401 - Unauthorized | Invalid access token |
| 404 - Not Found | The requested resource doesn’t exist |
| 500 | Something went wrong on our end |
| 503 | Server maintenance |
This API does provide partial responses, you can request individual items for further element details using its ID.
Authentication
Once you create an account, you can find your access token in your dashboard. This is your key to access this service
To authenticate requests, pass your access key via the authorization header of your request:
GET webapi/v1/tracks/serch?searchTerm=name HTTP/1.1
Host: api.hernandez-julio.com/
Authorization: Bearer {YOUR_ACCESS_KEY}
Accept: application/json
Pagination
Requests that return multiple items (a list of tracks, for example) will be paginated into pages of 20 items by default. The page query parameter can be supplied to define which page to be returned.
You can not request an arbitrary page, you should follow the links provided to go to a previous page or a next page.
If page is not supplied, the first page will be returned.
Pagination response
Additional pagination information is returned in the response Json. URL’s for the next, and prev pages are supplied, if applicable.
For example, after requesting page 3 of the track list:
{"Links":[
{"prev":"https://api.hernandez-julio.com/webapi/v1/tracks?page=e2lkPTF9"},
{"next":"https://api.hernandez-julio.com/webapi/v1/tracks?page=e2lkPTIxfQ"},
]}
If you have issues with your requests, please ensure your GET parameters are URL-encoded.
All text data returned is UTF-8.
All dates are in UTC (GMT).
API Endpoints.
Get a list of albums
https://api.hernandez-julio.com/webapi/v1/albums
Response:
200 OK
{
"lnks": {
"prev": "https://...webapi/v1/albums?page=2sds6",
"next": "https://...webapi/v1/albums?page=2sDs6=="
},
"data": [
{
"AlbumId": 1,
"Title": For those about to rock,
"ArtistId": 3768
},
{
"AlbumId": 2,
"Title": Balls to the wall,
"ArtistId": 2885
},
...
]
}
Get albums by search term
https://api.hernandez-julio.com/webapi/v1/albums/search?searchTerm=rock
Response:
200 OK
{
"lnks": {
"prev": "https://...webapi/v1/albums/search?searchTerm=rock&page=e2lkPTB9",
"next": "https://...webapi/v1/albums/search?searchTerm=rock&page=e2lkPTIxfQ=="
},
"data": [
{
"AlbumId":1,
"Title":"For Those About To Rock We Salute You",
"ArtistId":1
},
{
"AlbumId":4,
"Title":"Let There Be Rock",
"ArtistId":1
},
...
]
}
Get a list of employees
https://api.hernandez-julio.com/webapi/v1/employees
Response:
200 OK
{
"lnks": {
"prev": "https://...webapi/v1/albums?page=2sds6",
"next": "https://...webapi/v1/albums?page=2sDs6=="
},
"data": [
{
"EmployeeId": 1,
"LastName": "Apple",
"FirstName": "Hernandez",
"Title": "Apple",
"ReportsTo": 1,
"Email": "abc123@server1.com"
},
{
"EmployeeId": 1,
"LastName": "Apple",
"FirstName": "Hernandez",
"Title": "Apple",
"ReportsTo": 1,
"Email": "abc123@server1.com"
},
...
]
}
Get employee by Id
https://api.hernandez-julio.com/webapi/v1/employees/1
Response:
200 OK
{
"EmployeeId":1,
"LastName":"Adams",
"FirstName":"Andrew",
"Title":"General Manager",
"ReportsTo":null,
"BirthDate":"1962-02-18 00:00:00",
"HireDate":"2002-08-14 00:00:00",
"Address":"11120 Jasper Ave NW",
"City":"Edmonton",
"State":"AB",
"Country":"Canada",
"PostalCode":"T5K 2N1",
"Phone":"+1 (780) 428-9482",
"Fax":"+1 (780) 428-3457",
"Email":"andrew@chinookcorp.com"
}
Get the list of invoices
https://api.hernandez-julio.com/webapi/v1/invoice
Response:
200 OK
{
"lnks": {
"prev": "https://...webapi/v1/invoices?page=2sds6",
"next": "https://...webapi/v1/invoices?page=2sDs6=="
},
"data":[
{
"InvoiceId":1,
"CustomerId":2,
"InvoiceDate":"2009-01-01 00:00:00",
"Total":1.979999999999999983},
{
"InvoiceId":2,
"CustomerId":4,
"InvoiceDate":"2009-01-02 00:00:00",
"Total":3.959999999999999965
},
...
]}
Get the invoice by Id
https://api.hernandez-julio.com/webapi/v1/invoice/{InvoiceId}
Response:
200 OK
{
"InvoiceId":1,
"CustomerId":2,
"InvoiceDate":"2009-01-01 00:00:00",
"BillingAddress":"Theodor-Heuss-Straße 34",
"BillingCity":"Stuttgart",
"BillingState":null,
"BillingCountry":"Germany",
"BillingPostalCode":"70174",
"Total":1.979999999999999983
}
Get the list of tracks
https://api.hernandez-julio.com/webapi/v1/tracks
Response:
200 OK
{
"lnks": {
"prev": "https://...webapi/v1/tracks?page=2sds6",
"next": "https://...webapi/v1/tracks?page=2sDs6=="
},
"data":[
{
"TrackId":1,
"Name":"For Those About To Rock (We Salute You)",
"AlbumId":1,"MediaTypeId":1,
"Composer":"Angus Young, Malcolm Young, Brian Johnson",
"UnitPrice":0.989999999999999992
},
{
"TrackId":2,
"Name":"Balls to the Wall",
"AlbumId":2,
"Composer":null,
"UnitPrice":0.989999999999999992
},
...
]}
Get the track by Id
https://api.hernandez-julio.com/webapi/v1/tracks/1
Response:
200 OK
{
"TrackId":1,
"Name":"For Those About To Rock (We Salute You)",
"AlbumId":1,
"MediaTypeId":1,
"GenreId":1,
"Composer":"Angus Young, Malcolm Young, Brian Johnson",
"Milliseconds":343719,
"Bytes":11170334,
"UnitPrice":0.989999999999999992
}
Get tracks by search term
https://api.hernandez-julio.com/webapi/v1/tracks/search?searchTerm=name
Response:
200 OK
{
"lnks": {
"prev": "https://...webapi/v1/tracks/search?searchTerm=name&page=2sds6",
"next": "https://...webapi/v1/tracks/search?searchTerm=name&page=2sDs6=="
},
"data":[
{
"TrackId":1145,
"Name":"Whatsername",
"AlbumId":89,
"Composer":"Green Day",
"UnitPrice":0.989999999999999992
},
{
"TrackId":1211,
"Name":"Hallowed Be Thy Name (Live) [Non Album Bonus Track]",
"AlbumId":94,
"Composer":null,
"UnitPrice":0.989999999999999992
},
...
]}
Get the list of customers
https://api.hernandez-julio.com/webapi/v1/customers
Response:
200 OK
{
"lnks": {
"prev": "https://...webapi/v1/tracks/search?searchTerm=name&page=2sds6",
"next": "https://...webapi/v1/tracks/search?searchTerm=name&page=2sDs6=="
},
"data":[
{
"CustomerId":1,
"FirstName":"Luís",
"LastName":"Gonçalves",
"SupportRepId":3
},
{
"CustomerId":2,
"FirstName":"Leonie",
"LastName":"Köhler",
"SupportRepId":5},
...
]}
Get customer by Id
https://api.hernandez-julio.com/webapi/v1/customers/1
Response:
200 OK
{
"CustomerId":1,
"FirstName":"Luís",
"LastName":"Gonçalves",
"Company":"Embraer - Empresa Brasileira de Aeronáutica S.A.",
"Address":"Av. Brigadeiro Faria Lima, 2170",
"City":"São José dos Campos",
"State":"SP",
"Country":"Brazil",
"PostalCode":"12227-000",
"Phone":"+55 (12) 3923-5555",
"Fax":"+55 (12) 3923-5566",
"Email":"luisg@embraer.com.br",
"SupportRepId":3
}
Get the sales report
https://api.hernandez-julio.com/webapi/v1/sales
Response:
200 OK
{
"data":[
{
"TrackId":1,
"Name":"For Those About To Rock (We Salute You)",
"UnitPrice":0.989999999999999992,
"Quantity":1,
"Total":0.989999999999999992
},
{
"TrackId":2,
"Name":"Balls to the Wall",
"UnitPrice":0.989999999999999992,
"Quantity":2,
"Total":1.979999999999999983
},
...
]}
Get the sales report by representative
https://api.hernandez-julio.com/webapi/v1/salesbyrep
Response:
200 OK
{
"data":[
{
"EmployeeId":3,
"FirstName":"Jane",
"LastName":"Peacock",
"TotalSales":833.0399999999999637
},
{
"EmployeeId":4,
"FirstName":"Margaret",
"LastName":"Park",
"TotalSales":775.3999999999999773
},
...
]}
Get the sales report by quarter
https://api.hernandez-julio.com/webapi/v1/salesbyquarter
Response:
200 OK
{
"data":[
{
"Year":"2009",
"Quarter":1,
"TotalAmount":110.8799999999999955},
{
"Year":"2009",
"Quarter":2,
"TotalAmount":112.8599999999999995},
{
"Year":"2009",
"Quarter":3,
"TotalAmount":112.8599999999999995},
...
]}
Add a new album to the database
https://api.hernandez-julio.com/webapi/v1/albums
Response:
201 Created
{
"AlbumId": 1,
"Title": "Apple",
"ArtistId": 1
}
Add new employee to the database
https://api.hernandez-julio.com/webapi/v1/employees
Response:
201 Created
{
"EmployeeId": 1,
"LastName": "O'hara",
"FirstName": "Oscar",
"Title": "Supervisor",
"ReportsTo": 1,
"BirthDate": "2019-10-12T07:20:50.52Z",
"HireDate": "2019-10-12T07:20:50.52Z",
"Address": "Street 78th",
"City": "Kigaly",
"State": "Kigaly",
"Country": "Ruanda",
"PostalCode": "003000",
"Phone": "01-123456789",
"Fax": "123456",
"Email": "abc123@server1.com"
}
Add new track to the database
https://api.hernandez-julio.com/webapi/v1/tracks
Response:
201 Created
{
"TrackId": 1,
"Name": "Apple",
"AlbumId": 1,
"MediaTypeId": 1,
"GenreId": 1,
"Composer": "Mariano",
"Milliseconds": 650012,
"Bytes": 8761411,
"UnitPrice": 3.26
}
Add new customer to the database
https://api.hernandez-julio.com/webapi/v1/customers
Response:
201 Created
{
"FirstName": "Mark",
"LastName": "Johnson",
"Company": "apple",
"Address": "apple",
"City": "apple",
"State": "apple",
"Country": "apple",
"PostalCode": "apple",
"Phone": "apple",
"Fax": "string",
"Email": "apple68@yahoo.com",
"SupportRepId": 1,
"CustomerId": false
}
Update an album in the database
https://api.hernandez-julio.com/webapi/v1/albums/{AlbumId}
Response:
200 OK
{
"AlbumId": 1,
"Title": "Apple",
"ArtistId": 1
}
Update an employee in the database
https://api.hernandez-julio.com/webapi/v1/employee/{EmployeeId}
Response:
200 OK
{
"EmployeeId": 1,
"LastName": "O'hara",
"FirstName": "Oscar",
"Title": "Supervisor",
"ReportsTo": 1,
"BirthDate": "2019-10-12T07:20:50.52Z",
"HireDate": "2019-10-12T07:20:50.52Z",
"Address": "Street 78th",
"City": "Kigaly",
"State": "Kigaly",
"Country": "Ruanda",
"PostalCode": "003000",
"Phone": "01-123456789",
"Fax": "123456",
"Email": "abc123@server1.com"
}
Update an invoice in the database
https://api.hernandez-julio.com/webapi/v1/invoices/{InvoiceId}
Response:
200 OK
{
"InvoiceId": 5216,
"CustomerId": 1,
"InvoiceDate": "2019-10-12T07:20:50.52Z",
"BillingAddress": "Kigaly",
"BillingCity": "Kigaly",
"BillingState": "Kigaly",
"BillingCountry": "Kigaly",
"Total": 3.26
}
Update a track in the database
https://api.hernandez-julio.com/webapi/v1/tracks/{TrackId}
Response:
200 OK
{
"TrackId": 1,
"Name": "Apple",
"AlbumId": 1,
"MediaTypeId": 1,
"GenreId": 1,
"Composer": "Apple",
"Milliseconds": 1,
"Bytes": 1,
"UnitPrice": 3.26
}
Update a customer in the database
https://api.hernandez-julio.com/webapi/v1/customers/{CustomerId}
Response:
200 OK
{
"CustomerId": 1,
"FirstName": "Apple",
"LastName": "apple",
"SupportRepId": 1,
"Company": "apple",
"Address": "apple",
"City": "apple",
"State": "apple",
"Country": "apple",
"PostalCode": "apple",
"Phone": "apple",
"Fax": "apple",
"Email": "apple"
}
Delete an album from the database
https://api.hernandez-julio.com/webapi/v1/albums/{AlbumId}
Response:
200 OK
{
"DeletedAlbumId": 1
}
Delete an employee from the database
https://api.hernandez-julio.com/webapi/v1/employee/{EmployeeId}
Response:
200 OK
{
"DeletedEmployeeId": 7453
}
Delete a track from the database
https://api.hernandez-julio.com/webapi/v1/tracks/{TrackId}
Response:
200 OK
{
"DeletedTrackId": 7245
}
Delete a customer from the database
https://api.hernandez-julio.com/webapi/v1/customers/{CustomerId}
Response:
200 OK
{
"DeletedCustomerId": 4114
}