Hello Cuba Community,
We setup the REST API add on for a project. Everything seems to be working well. We noticed one issue that I am curious if someone else has run into before. When calling the API from curl we get a valid token and we can use that token to request/return data. It seems to be intermittent though.
Here is an output from the terminal. Lines with “[]” were valid API responses with data returned (removed returned data).
As you see from the curl output sometimes we return data sometimes we get an invalid token using the same request in succession.
Would the fact that the app is deployed to multiple instances matter?
If so would it be better to persist the token to the database?
Any other possibilities?
Curl Output
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_APIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_CoralAPIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_CoralAPIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
{"error":"invalid_token","error_description":"Invalid access token: 15fbbd58-812c-47e9-8115-bba6b917555f"}
C:\Users\smith>Curl -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Bearer 15fbbd58-812c-47e9-8115-bba6b917555f" "https://somesite.com/rest/v2/services/registry_CoralAPIService/getRegistryRecordByAccessionID?accessionID=02d0156c-167f-b0e0-b004-edb77d057d16"
[]
Appreciate the assistance.