Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

URL/api/sample/<sample_id>
DescriptionFetching the image of a Specific Sample Response
HeaderAPI_KEY, Authorization
MethodGET
Url Param

sample_id=[string]

Request Body Data

PUT
{ sampleData: xxx, image: xxx}

Note: SampleData should send as form-data text, and the image should be form-data file.

Response

{ sample: { id: xxx, dateTime: xxx, hasPict: xxx, hasSurvey: xxx, hasContainer: xxx } }
200: Success

{ message: ”This user does not have access to this sample data” }
403: Unauthorized

{ message: ”No such sample exists” }
404: Resource Not Found

{ message: ”This user does not have access to this sample data” }
403: Unauthorized

{ message: ”No such sample exists” }
404: Resource Not Found

 

 

 

URL/api/sample/<barcode_id>
DescriptionFetching a Specific Sample Response
HeaderAPI_KEY, Authorization
MethodGET
Url Param

barcode_id=[string]

Request Body Data

--

Response

{ sample: { id: xxx, dateTime: xxx, hasPict: xxx, hasSurvey: xxx, hasContainer: xxx } }
200: Success

{ message: ”This user does not have access to this sample data” }
403: Unauthorized

{ message: ”No such sample exists” }
404: Resource Not Found

...

URL/api/sample/<barcode_id>/image
DescriptionFetching the image of a Specific Sample Response
HeaderAPI_KEY, Authorization
MethodGET
Url Param

barcode_id=[string]

Request Body Data

--

Response

{ message: ”This user does not have access to this sample data” }
403: Unauthorized

{ message: ”No such sample exists” }
404: Resource Not Found

 

 

 

URL/api/sample/count_this_week
DescriptionReturn the total number the user uploaded this week
HeaderAPI_KEY, Authorization
MethodGET
Url Param 
Request Body Data

--

Response

{ "sampleCount": int } - 200

 

 

 

 

URL/api/sample/count_total
DescriptionReturn the total number the user uploaded
HeaderAPI_KEY, Authorization
MethodGET
Url Param--
Request Body Data

--

Response

{ "sampleCount": int } - 200

 

Survey APIs

URL/api/survey/questions
DescriptionReturns the sample survey when 'main_survey' is passed in as survey_name
HeaderAPI_KEY, Authorization
MethodGET
Url Paramsurvey_name
Request Body Data

--

Response
Wiki Markup
{questionsList: [{
        "questionId": "questionDiet",
        "questionText": "Whatwasyourbaby'sdiettoday?",
        "questionType": "questionTypeSingleSelect",
        "responses": [
            {
                "responseId": "responsesDiet_exclusiveBreastFeeding",
                "responseText": "ExclusiveBreastFeeding"
            },
...
...
...
]}



 

URL/api/survey
DescriptionPlace a survey into the database in order to be retrieved by the application in the future
HeaderAPI_KEY, Authorization
MethodPUT
Url Paramsurvey_name
Request Body Data

Survey to placed in the database

Response
{
"message": "Incorrect API key provided."
}
{
"message": "Survey stored!"
}, 200
If survey name not passed in,
{
"message"="Please pass in survey name to create a survey"
}, 400

 

 

URL/api/survey/question/<question_id>/responses
DescriptionReturn the responses to a question given the question id and survey name are passed in
HeaderAPI_KEY, Authorization
MethodGET
Url Paramsurvey_name
Request Body Data

--

Response
{responseList: []}, 200

 

When an incorrect question ID is passed in:

{
"message": "Question ID is not found!"
}, 400