Skip to content

Instantly share code, notes, and snippets.

@ben-gy
Last active September 24, 2021 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ben-gy/180d4e725fe842681e7a115748bdc0ed to your computer and use it in GitHub Desktop.
Save ben-gy/180d4e725fe842681e7a115748bdc0ed to your computer and use it in GitHub Desktop.
Sample API

API calls

Authentication

Handled with bearer token in the headers: Authorization: Bearer <token> where <token> is the api_key provisioned by Comply Group.

Sample received

POST   /api/v1/received_samples
params = {
  "samples": [
    {"uid": "123456", "received_at": "2021-09-23T01:45:02Z"},
    {"uid": "987654", "received_at": "2021-09-23T01:45:02Z"}
  ]
}

where uid is the TestResult.sample_uid and received_at is in iso8601 format.

Curl example:

curl -X POST -H "Authorization: Bearer <api_key>" -H "Content-Type: application/json" -d '{"samples":[{"uid": "123456", "received_at": "2021-09-23T01:45:02Z"},{"uid": "987654", "received_at": "2021-09-23T01:45:02Z"}]}' https://staging.covidaware.e.opscare.io/api/v1/received_samples

Response:

{
  "samples": [
    {"uid": "123456", "quantity": 1},
    {"uid": "987654", "quantity": 0}
  ]
}

where quantity is the number of matching TestResult with that sample_uid.

Sample Processed

POST   /api/v1/processed_samples
params = {
  "samples": [
    {
      "uid": "ABC123",
      "processed_at": "2021-09-23T01:45:02Z",
      "sample_assay": "this_field_is_optional",
      "sample_ct_value": "this_field_is_optional",
      "sample_result": "positive"
    }
  ]
}

where uid is the TestResult.sample_uid and processed_at is in iso8601 format.

Curl example:

curl -X POST -H "Authorization: Bearer <api_key>" -H "Content-Type: application/json" -d '{"samples":[{"uid": "ABC123","processed_at": "2021-09-23T01:45:02Z","sample_assay": "not_sure_what_this_should_be","sample_ct_value": "another_unknown","sample_result": "positive"}]}' https://staging.covidaware.e.opscare.io/api/v1/processed_samples

Response: same as sample received above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment