NIH | National Cancer Institute | NCI Wiki  

Versions Compared

Key

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

...

All service endpoints require Okta access token authentication. To generate an Okta access token, a request must be made to the environment service endpoint using a valid Client ID and Client Secret. See below for additional details on how to construct the access token request.

Method: POST

Service Endpoints:

Stage

...

https://bioappdev.okta.com/oauth2/

...

Stagehttps://bioappdev.okta.com/oauth2/aus478s3eb0x3du23297

Production: <Provide Prod URL here>

POST:

...

aus478s3eb0x3du23297/v1/token

Productionhttps://bioappdev.okta.com/oauth2/

...

...

Headers

Content-Type

application/x-www-form-

...

urlencoded

Accept

application/json

Parameters:

grant_type

client_credentials

...

...

Authorization:

Authorization TypeBasic

clientIdUsername

Client ID generated by CTRP Support for the user account

clientSecretPassword

Client Secret generated by CTRP Support for the user account

...

{"token_type":"Bearer","expires_in":1800<seconds>,"access_token":<accessToken>}

Info

The access token will expire 1 hour after being generated (1800 seconds).expiration period is set per the following:

Stage: 8 Hours (28800 seconds)

Production: 4 Hours (14400 seconds)

4. Call REST Service with Bearer Authentication

Once the access token has been generated, it will need to be included in the 'Authorization: Bearer' parameter when submitting API requests. The following example uses the accrual-services URL in the Int Stage environment and lists the required header and parameters values.

Method: PUT

Service Endpoint:

...

Stage

https://trials-int.nci.nih.gov/accrual-services/trials/

...

{idType}/{trialId}/sites/po/

...

{id}

idTypeType of identifier you want to use to identify a study in CTRP. Possible values: pa, nci, ctep, dcp
trialIDTrial identifier value itself
idPO identifier of the organization that is the site on the study

Headers

Accept-Encodinggzip, deflate, br
Connectionkeep-alive
Content-Type

application/xml

Accept

text/plain

Accept*/*  

Authorization:

Authorization TypeBearer Token

Token

...

--header 'Content-Type: application/json' \

--header 'Accept: application/xml' \

--header 'Authorization: Bearer <accessToken>'

Parameters:

accessToken

Access Token generated in step 3 .

idTypenci
trialIDNCI-2019-00038
id7434

Response:

...

above

Body:

Code Block
collapsetrue
<tns:studySubjects xmlns:tns="gov.nih.nci.accrual.webservices.types"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="gov.nih.nci.accrual.webservices.types ../../src/resources/ws.xsd ">
    <tns:studySubject>
        <tns:identifier>SU001</tns:identifier>
        <tns:birthDate>2002-01-01</tns:birthDate>
        <tns:gender>Female</tns:gender>
        <tns:race>Black or African American</tns:race>
        <tns:ethnicity>Not Hispanic or Latino</tns:ethnicity>
        <tns:country>USA</tns:country>
        <tns:zipCode>22201</tns:zipCode>
        <tns:registrationDate>2014-01-01</tns:registrationDate>
        <tns:methodOfPayment>MEDICAID_AND_MEDICARE</tns:methodOfPayment>
        <tns:disease codeSystem="ICD9">861.20</tns:disease>       
    </tns:studySubject>
</tns:studySubjects>


Error Codes for the Okta API

<Please provide>

Error

Code

Message

Invalid Client Id

401

{

    "errorCode": "invalid_client",

    "errorSummary": "Invalid value for 'client_id' parameter.",

    "errorLink": "invalid_client",

    "errorId": "oaejDJuWCiRTQeH8n6WG2116A",

    "errorCauses": []

}

Invalid Client Secret

401

{

    "error": "invalid_client",

    "error_description": "The client secret supplied for a confidential client is invalid."

}

Invalid User Credentials / Account Locked*

400

{

    "error": "invalid_grant",

    "error_description": "The credentials provided were invalid."

}

Invalid/Expired access token<Please provide>

Password Rotation

The Client ID and Client Secret need to be updated on a yearly basis. Contact the CTRP Support to obtain a new Client ID / Client Secret combination.

...