GithubHelp home page GithubHelp logo

waste_deposit_hunting's Introduction

waste_deposit_hunting

The waste_deposit_hunting project has the purpose to handle mobile users's reports about waste deposits in Arkhangelsk's area.


API Docs

Interface to post the report

URI Method Authorization
/reports/ POST not required

Param: data, where comment and feedback_info are not required and lat and long must be in WGS84 format and belong to the Arkhangelsk's area.

lat=12.12334
long=12.12334
photo=test_photo.jpg
comment=some_text_string
feedback_info=some_text_string

Success Response:

  • Code: 201
  • Content:
{
  "datetime_received": "2019-12-06T19:26:47.796141+03:00",
  "photo": "http://0.0.0.0:8000/api/v1/reports/photos/2019/12/06/test_photo.jpg",
  "lat": 12.12334,
  "long": 12.12334,
  "comment": "some_text_string",
  "feedback_info": "some_text_string",
  "waste_deposit": 1
}

Error Responses:

  • Code: 400

  • Content:

{
  "code": "no_photo",
  "msg" : "Фотография является обязательной."
}
  • Possible codes: "no_photo" for missing photo argument, "no_long" for longitude, "no_lat" for latitude.
  • How to solve: provide missing required argument.

  • Code: 400

  • Content:

{
  "code": "invalid_lat",
  "msg" : "Невалидная широта."
}
  • Possible codes: "invalid_long" for invalid longitude, "invalid_lat" for latitude.
  • How to solve: provide valid argument.

  • Code: 400

  • Content:

{
  "code": "invalid_geo_state",
  "msg" : "На данным момент приложение работает только на територии Архангельской области. Пожалуйста, измените выбор местоположения."
}
  • How to solve: provide latitude and longitude belonged to the Arkhangelsk's area.

Sample Call:

curl -X POST -H "Content-Type:multipart/form-data" -F "long=12.12334" -F "lat=12.12334" -F "photo=@test_photo.jpg" http://0.0.0.0:8000/api/v1/reports/

Interface to list all reports

URI Method Authorization
/reports/ GET not required

Success Response:

  • Code: 200
  • Content:
{
    "count": 2,
    "next": "http://0.0.0.0:8000/api/v1/reports/?page=2",
    "previous": null,
    "results": [
        {
            "id": 1,
            "datetime_received": "2019-12-30T13:18:39.566743+03:00",
            "photo": "http://0.0.0.0:8000/api/v1/reports/photos/2019/12/06/test_photo.jpg",
            "lat": 64.61833411,
            "long": 40.9587337
        }
    ]
}

Page limit is 10 reports per page.

Sample Call to get 11th-20th reports:

curl http://0.0.0.0:8000/api/v1/reports/?page=2

Also there is a possibility to get whole reports list via 'all=true' query parameter. Sample Call to get all reports:

curl http://0.0.0.0:8000/api/v1/reports/?all=true

Interface to post the report content complain

URI Method Authorization
/reports/{report_id}/content-complain/ POST not required

Param:

{
"body": "some complain text"  // is required param
}

Success Response:

  • Code: 201
  • Content:
{
"report": 1, 
"body": "some complain text"
}

Error Responses:

  • Code: 404

  • Content:

{
  "code": "no_found",
  "msg" : "Не найдено."
}

  • How to solve: provide id of the existing report.

  • Code: 400

  • Content:

{
  "code": "no_body",
  "msg" : "Добавьте текст жалобы."
}
  • How to solve: provide no-empty body parameter.

waste_deposit_hunting's People

Contributors

polina-popova avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.