Ssibrahimbas location-app
With this API you can currently add, list, filter, delete and update countries and cities.
Endpoints
Create Country
You can add country with this endpoint.
Parameters
Parameter | Is Required | Type |
---|---|---|
name | true | string |
langCode | true | string |
Returns
is success
{ "success": true, "message": "Country successfully created" }
Validation Error
{ "success": false, "message": "Validation Error", "data": [ { "field": "name", "message": "name field is required" } ] }
Authorization Error
{ "success": false, "message": "You must be logged in to access this page" }
Example Requests
look at requests folder for example requests.
Update Country
You can update country with this endpoint.
Parameters
Parameter | Is Required | Type |
---|---|---|
name | false | string |
langCode | false | string |
Note: you just have to submit the field you want to update. If the name and langCode are not sent at the same time, an error will be returned.
Returns
is success
{ "success": true, "message": "Country successfully updated" }
Not Changed
{ "success": false, "message": "Change not detected." }
Authorization Error
{ "success": false, "message": "You must be logged in to access this page" }
Example Requests
look at requests folder for example requests.
Get Country
You can get country with this endpoint.
Parameters
Parameter | Is Required | Type |
---|---|---|
id | true | integer |
Returns
is success
{ "success": true, "message": "Country successfully fetched", "data": { "id": 1, "name": "Ukraine", "langCode": "uk-UA" } }
Validation Error
{ "success": false, "message": "Validation Error", "data": [ { "field": "id", "message": "id field is required" } ] }
Example Requests
look at requests folder for example requests.
GetAll Country
You can get all countries with this endpoint.
Parameters
Parameter | Is Required | Type | Default |
---|---|---|---|
page | false | integer | 1 |
limit | false | integer | 20 |
order | false | string | name |
sort | false | string | desc |
filter | false | string | - |
Returns
is success
{ "success": true, "message": "Countries successfully fetched", "data": { "page": 2, "limit": 20, "countries": [ { "id": 2, "name": "Ukraine", "langCode": "uk-UA" }, { "id": 3, "name": "Turkey", "langCode": "tr-TR" } ] } }
Example Requests
look at requests folder for example requests.
Delete Country
You can delete country with this endpoint.
Parameters
Parameter | Is Required | Type |
---|---|---|
id | true | integer |
Returns
is success
{ "success": true, "message": "Country successfully deleted" }
Validation Error
{ "success": false, "message": "Validation Error", "data": [ { "field": "id", "message": "id field is required" } ] }
Authorization Error
{ "success": false, "message": "You must be logged in to access this page" }
Example Requests
look at requests folder for example requests.
Create City
You can add city with this endpoint.
Parameters
Parameter | Is Required | Type |
---|---|---|
name | true | string |
plateCode | true | number |
countryId | true | number |
Returns
is success
{ "success": true, "message": "City successfully created" }
Validation Error
{ "success": false, "message": "Validation Error", "data": [ { "field": "name", "message": "name field is required" } ] }
Authorization Error
{ "success": false, "message": "You must be logged in to access this page" }
Example Requests
look at requests folder for example requests.
Update City
You can update city with this endpoint.
Parameters
Parameter | Is Required | Type |
---|---|---|
name | false | string |
plateCode | false | number |
Note: you just have to submit the field you want to update. If the name and plateCode are not sent at the same time, an error will be returned.
Returns
is success
{ "success": true, "message": "City successfully updated" }
Not Changed
{ "success": false, "message": "Change not detected." }
Authorization Error
{ "success": false, "message": "You must be logged in to access this page" }
Example Requests
look at requests folder for example requests.
Get City
You can get city with this endpoint.
Parameters
Parameter | Is Required | Type |
---|---|---|
id | true | integer |
Returns
is success
{ "success": true, "message": "City successfully fetched", "data": { "cityId": 1, "cityName": "Istanbul", "countryId": 1, "plateCode": 34, "countryName": "Turkey", "langCode": "tr-TR" } }
Validation Error
{ "success": false, "message": "Validation Error", "data": [ { "field": "id", "message": "id field is required" } ] }
Example Requests
look at requests folder for example requests.
GetAll Cities
You can get all cities with this endpoint.
Parameters
Parameter | Is Required | Type | Default |
---|---|---|---|
page | false | integer | 1 |
limit | false | integer | 20 |
order | false | string | name |
sort | false | string | desc |
filter | false | string | - |
countryId | false | number | - |
Returns
is success
{ "success": true, "message": "Cities successfully fetched", "data": { "page": 1, "limit": 20, "cities": [ { "cityId": 1, "cityName": "İstanbul", "plateCode": 34, "countryId": 1, "countryName": "Turkey", "langCode": "tr-TR" }, { "cityId": 2, "cityName": "Ankara", "plateCode": 6, "countryId": 1, "countryName": "Turkey", "langCode": "tr-TR" } ] }
Example Requests
look at requests folder for example requests.
Delete City
You can delete city with this endpoint.
Parameters
Parameter | Is Required | Type |
---|---|---|
id | true | integer |
Returns
is success
{ "success": true, "message": "City successfully deleted" }
Validation Error
{ "success": false, "message": "Validation Error", "data": [ { "field": "id", "message": "id field is required" } ] }
Authorization Error
{ "success": false, "message": "You must be logged in to access this page" }
Example Requests
look at requests folder for example requests.
Register
You can get register to this app with this endpoint.
Parameters
Parameter | Is Required | Type | Default |
---|---|---|---|
false | string | [email protected] | |
password | false | string | 12345 |
Returns
is success
{ "success": true, "message": "User register successfully" }
already exists
{ "success": false, "message": "User already exists." }
Validation Error
{ "success": false, "message": "Validation Error", "data": [ { "field": "email", "message": "email field is required" }, { "field": "password", "message": "password field is required" } ] }
Log In
You can get login to this app with this endpoint.
Parameters
Parameter | Is Required | Type | Default |
---|---|---|---|
false | string | [email protected] | |
password | false | string | 12345 |
Returns
is success
{ "success": true, "message": "Successfully logged in", "data": { "email": "[email protected]", "createdAt": "2022-03-27" } }
not found
{ "success": false, "message": "User not found." }
Validation Error
{ "success": false, "message": "Validation Error", "data": [ { "field": "email", "message": "email field is required" }, { "field": "password", "message": "password field is required" } ] }
Log Out
You can get log out from this app with this endpoint.
Returns
Authorization Error
{ "success": false, "message": "You must be logged in to access this page" }
is success
{ "success": true, "message": "Successfully Signed out" }