Documentation API Cosmic Latte - JU-DEV-Bootcamps/ERAS GitHub Wiki
Endpoints list to obtain survey information
Authorization: Add header "x-apikey" with Api key
Evaluations
Get all evaluations:
This endpoint returns all the evaluations related to the API key. (Even if there are several surveys, all the evaluations are returned together). If we send Evaluation_id this only retrieves an evaluation
- Requieres header with API key
- GET https://staging.cosmic-latte.com/api/1.0/evaluations
- GET https://staging.cosmic-latte.com/api/1.0/evaluations?$filter=parent eq 'evaluationSets:ID_Questionnaire'
- GET https://staging.cosmic-latte.com/api/1.0/evaluations?$filter=name eq "NOMBRE_DE_CUESTIONARIO" => It cant have slash "/"
- GET https://staging.cosmic-latte.com/api/1.0/evaluations?$filter=contains(name, 'Encuesta de carac') => It cant have slash "/"
- GET https://staging.cosmic-latte.com/api/1.0/evaluations/**:Evaluation_id**
- Response: List with evaluations
Get results of an evaluation by its ID (sent in the body)
POST: https://staging.cosmic-latte.com/api/1.0/evaluations/exec/evaluationAnswers
- Requires header with API key
- Requires body with: { "@data": { "_id": "Evaluation_id" } }
- Response: Details of an evaluation
Get results of a set of evaluations by its ID of questionnaire (This value is in the field "evaluationSets:ID_Questionnaire")
POST: https://staging.cosmic-latte.com/api/1.0/evaluationSets/exec/evaluationsAnswers
- Requires header with API key
- Requires body with: { "@data": { "_id": "ID_Questionnaire" } }
- Response: List of answers for the questionnaire, all answers in text form
Get evaluation details by the ID
POST: https://staging.cosmic-latte.com/api/1.0/evaluations/exec/evaluationDetails
- Requires header with API key
- Requires body with: { "@data": { "_id": "Evaluation_id" } }
- Response: List of questions and answers
Endpoints to obtain survey information
Steps:
- Get questionnaire ID (endpoint api/1.0/evaluations, filter by name)
- In the response, in any of the evaluations, there is a property called “parent” that contains a value with the questionnaire id: "parent": "evaluationSets:ahdcosdMBR8aFsM9D" You have to remove the “evaluationSets:” part and the rest will be the id
- Call the evaluationSets/exec/evaluationsAnswers endpoint and within the response:
- the first array brings the ids of the evaluations made by users that correspond to that questionnaire.
- The first 10 arrays are information about schedules, start, end and other details
- After the tenth array, the array of responses to each question in the form begins. Contains the textual response
- Obtain questions: request to endpoint evaluations/exec/evaluationDetails (by any evaluation id) and this retrieve questions in text form and position to be mapped