From 71f77eac5c5c6f05e9f3c558461a3ad6b0e2412e Mon Sep 17 00:00:00 2001 From: Simon Pelletier Date: Fri, 12 Jun 2020 11:33:47 -0400 Subject: [PATCH] [API] Valid POST request of a candidate added to the API TestPlan (#6601) In the API TestPlan, the example of a POST request to create a new candidate does not create a candidate. The new command line example creates a new candidate successfully. Resolves #6590 --- modules/api/test/TestPlan.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/api/test/TestPlan.md b/modules/api/test/TestPlan.md index f5e025a8fe0..8742910b511 100644 --- a/modules/api/test/TestPlan.md +++ b/modules/api/test/TestPlan.md @@ -33,10 +33,12 @@ See specification for the expected response format. #### Candidate creation - POST /candidates -Candidate creation -This is done by sending a POST request to /candidates with the required data. Note the usage of the Authorization header. +Candidate creation is done by sending a POST request to /candidates with the required data. Note the usage of the Authorization header. For a candidate to be created, the candidate's information must also be included. The following command contains the minimal information necessary for the request to create a new candidate (see [docs](../../../docs/API/LorisRESTAPI_v0.0.3.md#30-candidate-api) for format instructions): + ```bash -~$ curl -H "Authorization: Bearer $token" https:///api/v0.0.3/candidates -d '{see specs for content}' +~$ curl -H "Authorization: Bearer $token" https:///api/v0.0.3/candidates -d '{"Candidate":{"Project":"Rye","Site":"Montreal","DoB":"2019-01-31", "Sex":"Female"}}' ``` +If the candidate is successfully created, the candidate's data is returned. For example, the previous example returns: `{"CandID":"872451","Project":"Rye","PSCID":"MTL185","Site":"Montreal","EDC":null,"DoB":"2019-01-31","Sex":"Female"}` +Otherwise, an error message is returned. For example, the command `curl -H "Authorization: Bearer $token" https:///api/v0.0.3/candidates -d ''` returns `{"error":"You are not affiliated with the candidate's site"}`