Skip to content

Commit

Permalink
[API] Valid POST request of a candidate added to the API TestPlan (#6601
Browse files Browse the repository at this point in the history
)

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
  • Loading branch information
spell00 committed Jun 12, 2020
1 parent 2ac5a55 commit 71f77ea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/api/test/TestPlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://<your-hostname>/api/v0.0.3/candidates -d '{see specs for content}'
~$ curl -H "Authorization: Bearer $token" https://<your-hostname>/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://<your-hostname>/api/v0.0.3/candidates -d ''` returns `{"error":"You are not affiliated with the candidate's site"}`

0 comments on commit 71f77ea

Please # to comment.