Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11. Get Cash Dispensers Near a Market #11

Open
JorjaF opened this issue Aug 28, 2023 · 0 comments
Open

11. Get Cash Dispensers Near a Market #11

JorjaF opened this issue Aug 28, 2023 · 0 comments

Comments

@JorjaF
Copy link
Owner

JorjaF commented Aug 28, 2023

Details:

The endpoint should be in the pattern of GET /api/v0/markets/:id/nearest_atms

You will need to utilize the TomTom API for this. Specifically, the category search endpoint.

Find a category that would work for ATM’s, and use the API to find ATM’s near the location of the Farmer’s Market.

The atms that are returned should be in the order of closest to furthest away.

If an invalid market id is passed in, a 404 status as well as a descriptive error message should be sent back in the response.

The data top level key should always point to an array even if one or zero atms were located near the market location.

Example #1 😁
Request:

GET /api/v0/markets/327794/nearest_atms
Content-Type: application/json
Accept: application/json
Response: status: 200

{
"data": [
{
"id": null,
"type": "atm",
"attributes": {
"name": "ATM",
"address": "3902 Central Avenue Southeast, Albuquerque, NM 87108",
"lat": 35.07904,
"lon": -106.60068,
"distance": 0.10521432030421865
}
},
{
"id": null,
"type": "atm",
"attributes": {
"name": "ATM",
"address": "4100 Central Avenue Southeast, Albuquerque, NM 87108",
"lat": 35.0788,
"lon": -106.59842,
"distance": 0.14448001321588486
}
},
...,
...,
...,
]
}

Example #2 😭
Request:

 GET /api/v0/markets/123123123123/nearest_atm (where `123123123123` is an invalid Market id)
 Content-Type: application/json
 Accept: application/json

Response: status: 404

{
"errors": [
{
"detail": "Couldn't find Market with 'id'=123123123123"
}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant