NIH | National Cancer Institute | NCI Wiki  

WIKI MAINTENANCE NOTICE

Please be advised that NCI Wiki will be undergoing maintenance Monday, July 22nd between 1700 ET and 1800 ET and will be unavailable during this period.
Please ensure all work is saved before said time.

If you have any questions or concerns, please contact the CBIIT Atlassian Management Team.

Error rendering macro 'rw-search'

null

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

This page describes the tasks required to obtain the proper authorization to use the NCI CTRP API. For any questions or support contact CTRP_support@nih.gov.

1. Create NCI CTRP user account

All users are required to have a valid CTRP user account to access CTRP applications (CTRP Registration and CTRP Accrual) and use the CTRP API. For instructions on requesting a CTRP account, refer to the following: Creating New NCI CTRP User Accounts.

2. Obtain NCI CTRP Client ID and Client Secret

Once your NCI CTRP user account has been created, contact CTRP_support@nih.gov to request access to use the CTRP APIs. CTRP Support will review the request and, if approved, will generate a Client ID and Client Secret for your account and provide these key values to you. The Client ID and Client secret are required parameters to generate an Okta Authentication Token. 

3. Generate Okta access token

All service endpoints require Okta 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.

Service Endpoints:

Int: <Provide Int URL here>

Stage: @bioappdev.okta.com/oauth2/aus3ym6wniM6O3MGE297/v1/token” \

Production: <Provide Prod URL here>

POST:

curl --request POST “https://<clientId>:<clientSecret>@bioappdev.okta.com/oauth2/aus3ym6wniM6O3MGE297/v1/token” \
--header “Accept: application/json” \
--header “Content-Type: application/x-www-form-urlencoded” \
--data-urlencode “grant_type=client_credentials" \

Parameters:

clientId

Client ID generated by CTRP Support for the user account

clientSecret

Client Secret generated by CTRP Support for the user account

Response:

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

The access token will expire 12 hours after being generated (43,200 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 environment and lists the required header and parameters values.

PUT:

curl --location --request PUT 'https://trials-int.nci.nih.gov/accrual-services/trials/nci/NCI-2019-00038/sites/po/7434 ' \

--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:

JSON or XML data, depending on which service is being used.

Error Codes for the Okta API

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><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.

Error Codes for the Okta API

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."

}

CTRP REST services

See the following for additional details on the various CTRP web services: 

  • No labels