Skip to content

Goal Resource

Ana Daniel edited this page Feb 10, 2016 · 8 revisions
  • Path: POST /user/goal

  • Requires Authorization: Yes

  • Requires User Token: Yes

  • Accepts: application/json

  • Produces: application/json

  • Body:

    {
     "frequency" : {daily(optional)},
     "createdDate" : {date format yyyy-mm-dd when the Goal has being created},
     "dueDate" : {date format yyyy-mm-dd when the Goal has to be achieved},
     "measureType" : {id of the Measure type},
     "objective" : {comparison operator (<,<=,>,>=)},
     "value" : {value to be achieved}
    }
  • Response:

    {
     "id": 6,
     "frequency": "daily",
     "objective": "<=",
     "value": 300,
     "createdDate": "2016-02-09",
     "dueDate": "2016-02-09",
     "achieved": 0,
     "hmType": {
       "id": 1,
       "name": "weight",
       "units": "kg"
     }
    }
    
  • Path: GET /user/goalslist

  • Require Authorization: Yes

  • Produces: application/json

  • Response:

    [
     {
       "id": 6,
       "frequency": "daily",
       "objective": "<=",
       "value": 300,
       "createdDate": "2016-02-08",
       "dueDate": "2016-02-08",
       "achieved": 0,
       "hmType": {
         "id": 1,
         "name": "weight",
         "units": "kg"
       }
     },
     {
       "id": 5,
       "frequency": "daily",
       "objective": "<=",
       "value": 300,
       "createdDate": "2016-02-08",
       "dueDate": "2016-02-08",
       "achieved": 0,
       "hmType": {
         "id": 1,
         "name": "weight",
         "units": "kg"
       }
     }
    ]
    

Starts a procedure to check if goals were achieved and update them. Returns list of updated goals.

  • Path: GET /user/goal-update

  • Requires Authorization: Yes

  • Requires User Token: Yes

  • Produces: application/json

  • Response:

    [
     {
       "id": 6,
       "frequency": "daily",
       "objective": "<=",
       "value": 300,
       "createdDate": "2016-02-08",
       "dueDate": "2016-02-08",
       "achieved": 0,
       "hmType": {
         "id": 1,
         "name": "weight",
         "units": "kg"
       }
     },
     {
       "id": 5,
       "frequency": "daily",
       "objective": "<=",
       "value": 300,
       "createdDate": "2016-02-08",
       "dueDate": "2016-02-08",
       "achieved": 1,
       "hmType": {
         "id": 1,
         "name": "weight",
         "units": "kg"
       }
     }
    ]
    

Starts a procedure to duplicate recurrent goals.

  • Path: GET /user/goal-update

  • Requires Authorization: Yes

  • Requires User Token: Yes

  • Produces: application/json

  • Response:

    [
     {
       "id": 6,
       "frequency": "daily",
       "objective": "<=",
       "value": 300,
       "createdDate": "2016-02-08",
       "dueDate": "2016-02-08",
       "achieved": 0,
       "hmType": {
         "id": 1,
         "name": "weight",
         "units": "kg"
       }
     },
     {
       "id": 5,
       "frequency": "daily",
       "objective": "<=",
       "value": 300,
       "createdDate": "2016-02-08",
       "dueDate": "2016-02-08",
       "achieved": 0,
       "hmType": {
         "id": 1,
         "name": "weight",
         "units": "kg"
       }
     }
    ]
    

Clone this wiki locally