IBM expects to have the handshake / connectivity test endpoint available in the first week of May; we will need to participate in testing it at that point

NOTE from Ray Chu

The authorizer is not caching any authentication at the moment, so you would need to obtain a new bearer token before each call. All endpoints are POST except the health check

To obtain your bearer token, use the following command:

getToken(){
API_ENV=${1:-'test'}
if [ "$API_ENV" = "test" ]; then
	CLIENT_ID=va_gov_test
	CLIENT_SECRET='82665781-77c1-4a98-8960-af077b918955'
elif [ "$API_ENV" = "dev" ]; then
	CLIENT_ID=va_gov_dev
	CLIENT_SECRET='ce676c36-0e8e-4ab8-bd55-8cd2e86a267f'
fi

RES=`curl --location --request POST "https://iam-$API_ENV.ibm-intelligent-automation.com/auth/realms/APCAS/protocol/openid-connect/token" \\
--header 'Content-Type: application/x-www-form-urlencoded' \\
--data-urlencode 'grant_type=client_credentials' \\
--data-urlencode 'scope=openid' \\
--data-urlencode "client_id=$CLIENT_ID" \\
--data-urlencode "client_secret=$CLIENT_SECRET"`

BEARERTOKENHERE=$(eval echo `echo $RES | jq '.access_token'`)
echo $BEARERTOKENHERE
API_URL="https://viccs-api-$API_ENV.ibm-intelligent-automation.com/api"
echo $API_URL
}

getToken

The tokens expire in 5 minutes. After obtaining a bearer token, pass that as a header for any of the APIs like so:

curl --location --request GET "$API_URL[/healthCheck](<https://viccs-api-dev.ibm-intelligent-automation.com/api/healthCheck>)" \\
 -H "Authorization: Bearer $BEARERTOKENHERE"

pcInsertAnnotOnlyCollection: (Request_EXTRACTED_Data)

cat raychu.json
{
   "vtrnFileId":"000000000",
   "vtrnFirstName":"Ray",
   "vtrnLastName":"Chu",
   "conditions":[
      "ASTHMA"
   ],
   "startDate":"01/01/2021",
   "endDate":"02/02/2022"
}

PAYLOAD=`jq . raychu.json`
curl "$API_URL/pcInsertAnnotOnlyCollection" \\
 -H "Authorization: Bearer $BEARERTOKENHERE" \\
 -H "Content-Type: application/json" \\
 -d "$PAYLOAD"

Other users in the dev env:

000000000
Development
Veteran

77220061
REBECCA
PEARSON

pcCheckCollectionStatus: (Query_EXTRACTED_Data_Status)

COL_ID=975
curl -v --trace ma.log --show-error -XPOST "$API_URL/pcCheckCollectionStatus" \\
 -H "Authorization: Bearer $BEARERTOKENHERE" \\
 -H 'Content-Type: application/json' \\
 -d "{\\"collectionsId\\":$COL_ID}"

pcQueryCollectionAnnots: (Return_EXTRACTED_Data)

curl -v --http1.1 -XPOST "$API_URL/pcQueryCollectionAnnots" \\
 -H "Authorization: Bearer $BEARERTOKENHERE" \\
 -H 'Content-Type: application/json' \\
 -d "{\\"collectionsId\\":$COL_ID}"