APIs to register lost dogs and found dogs, the data will be collected in FireStore
- Need to install all needed libraries by using pip commands (you can see the list in
requirements.txt
) - Need to get
serviceAccountKey.json
from the owner - Run
python .\app.py
in the root directory - If everything is OK, you should be able to access http://localhost:5000/
This is the API to register a lost dog before declaring the dog actually lost.
Parameters
customer_id
line customer idimage
the image URL on s3 we get from Botnoibreed
the dog breeddog_name
the dog name in Thaidog_age
the format is in {year}-{month} ex -> 1-6 age = 1 year 6 monthsdog_gender
0 | 1 , 1 is male, 0 is femaledisplay_name
(optional) line customer display name
Curl command
curl --location --request POST 'http://localhost:5000/register' \
--header 'Content-Type: application/json' \
--data-raw ' {
"customer_id": "xxx-xxxx-xxxx-1",
"display_name": "Oad",
"owner_name": "อธิการ บ่ดี",
"image": "s3-image-url-from-botnoi",
"dog_name": "dog",
"dog_age": "1-6",
"dog_gender": 1,
"breed": "โกลเด้น"
}'
Get method API to get all registered dog from a given customer id.
Parameters
customer_id
line customer id in query string
Return List of registered dog with following information
breed
the dog breeddog_id
the generated dog id from Firebasedog_age
dog age in monthdog_gender
0 | 1, 1 is male, 0 is femaleimage
the dog image URLname
the dog name
Curl command
curl --location --request GET 'http://localhost:5000/get-dogs/xxx-xxxx-xxxx-1'
The API to declare the registered dog as lost (need to do the registration before).
Parameter
customer_id
line customer idphone
the customer phone numberdog_id
generated dog idlocation
the lat, long coordination where the dog lost
Return List of match dogs from found list. It can return empty list if there is no match dog at all.
dog_id
the generated id from Firebasebreed
the dog breed in Thaiimage
the dog image URLdistance
the distance between the match dogs
Curl command
curl --location --request POST 'http://localhost:5000/lost-preregister' \
--header 'Content-Type: application/json' \
--data-raw '{
"customer_id": "xxx-xxxx-xxxx-1",
"dog_id": "h9YCNMw66OUFVEYvC1En",
"phone": "0847485152",
"location": {
"lat": 13.942084564850742,
"long": 100.55160812822899
}
}'
The API to declare a dog as lost.
Parameter
customer_id
line customer idphone
the customer phone numberdisplay_name
line customer display nameimage
the image URL on s3 we get from Botnoidog_name
the dog namedog_age
the format is in {year}-{month} ex -> 1-6 age = 1 year 6 monthsdog_gender
0 | 1, 1 is male, 0 is femalebreed
the dog breed in Thailocation
the lat, long coordination where the dog lost
Return List of match dogs from found list. It can return empty list if there is no match dog at all.
dog_id
the generated id from Firebasebreed
the dog breedimage
the dog image URLdistance
the distance between the match dogs
Curl command
curl --location --request POST 'http://localhost:5000/lost-register' \
--header 'Content-Type: application/json' \
--data-raw ' {
"customer_id": "xxx-xxxx-xxxx-2",
"display_name": "Pao",
"owner_name": "สมชาย เข็มกลัด",
"phone": "0909998888",
"image": "s3-image-url-from-botnoi",
"dog_name": "dog1",
"dog_gender": 0,
"dog_age": "2-3",
"breed": "พุดเดิ้ล",
"location": {
"lat": 13.942084564850742,
"long": 100.55160812822899
}
}'
API to declare a found dog. Parameter
customer_id
line customer iddisplay_name
line customer display nameimage
the image URL on s3 we get from Botnoilocation
the lat, long coordination that user found the dog
Return List of match dogs from lost list. It can return empty list if there is no match dog at all.
dog_id
the generated id from Firebasebreed
the dog breedimage
the dog image URLdistance
the distance between the match dogs
Curl command
curl --location --request POST 'http://localhost:5000/found' \
--header 'Content-Type: application/json' \
--data-raw ' {
"customer_id": "xxx-xxxx-found-5",
"display_name": "Godz",
"image": "s3-image-url-from-botnoi",
"location": {
"lat": 13.942084564850742,
"long": 100.55160812822899
}
}'
The API for testing scanning function. For example we have a lost dog, we would like to match found dogs or vice versa. Parameter
case
found or lost, if case is found it means we're looking for lost dogsbreed
the dog breedimage
the dog imagelocation
the dog location as lat, long coordination
Return List of match dogs. It can return empty list if there is no match dog at all.
dog_id
the generated id from Firebasebreed
the dog breedimage
the dog image URLdistance
the distance between the match dogs
Curl command
curl --location --request POST 'http://localhost:5000/test' \
--header 'Content-Type: application/json' \
--data-raw '{
"case": "found",
"breed": "chow chow",
"image": "s3-image-url-from-botnoi",
"location": {
"lat": 13.893889357391064,
"long": 100.56006330613269
}
}'
- Heroku CLI : download Heroku CLI
- Docker : download docker
- Login Heroku
heroku login
- Login Heroku Container
heroku container:login
- Push the container to Heroku
heroku container:push web --app dog-finder01
- Release the newly pushed image
heroku container:release web --app dog-finder01
- Now you should be able to access
https://dog-finder01.herokuapp.com/
, it should say API is running