Dataset API "getRetrievalInstructions" returns 500 error code when issuing a request.
In Glab, Validation and Preshipping environment a 500 error is returned when issuing a valid request to getRetrievalInstructions (see request/responses get_retrieval_instructions_500_unknown_validation_env.txt) whereas the other endpoint returns a correct retrieval_instructions_200_validation_env.txt)
Attached also glab dataset_get_retrieval_information_500_error.txt for the error.
Request: getRetrievalInstructions returns 500 error code
curl -location --request GET 'https://osdu-demo.msft-osdu-test.org/api/dataset/v1/getRetrievalInstructions?id=opendes:dataset-File.Generic:67be95dcfdb54343aec877fbb52bdd89' \
--header 'Data-Partition-Id: opendes' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json'
Response:
{"code":500,"reason":"Server error.","message":"An unknown error has occurred."}
Request: retrievalinstructions endpoint returns 200 Success Response
curl -location --request GET 'https://osdu-demo.msft-osdu-test.org/api/dataset/v1/retrievalInstructions?id=opendes:dataset-File.Generic:67be95dcfdb54343aec877fbb52bdd89' \
--header 'Data-Partition-Id: opendes' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json'
Response:
{
"providerKey": "AZURE",
"datasets": [
{
"datasetRegistryId": "opendes:dataset--File.Generic:67be95dcfdb54343aec877fbb52bdd89",
"retrievalProperties":
{ "signedUrl": "https://osdumvpdp1demoesyxdata.blob.core.windows.net/file-persistent-area/osdu-user%2F1662482672814-2022-09-06-16-44-32-814%2F25b93bc2553e48b3832b4e8dd20a646d?sv=2020-08-04&se=2022-09-13T23%3A42%3A25Z&sr=b&sp=r&sig=YAMtXJ2MPPsYov1cm3uEySlx%2FlomITbMEN%2BoL7tzd5c%3D", "createdBy": "osdu-user" }
}
]
}
Analysis
Dataset API (/api/dataset/v1/getRetrievalInstructions) calls File API DMSHandler (api/file/v2/files/retrievalInstructions) based on the request Kind File.Generic
[GetDatasetRetrievalInstructionsResponse] ---> [RetrievalInstructionsResponse]
From File API response Type(RetrievalInstructionsResponse) cannot able to deserialize to Dataset API response Type (GetDatasetRetrievalInstructionsResponse), which causes null pointer exception.
Note: Dataset API (/api/dataset/v1/retrievalInstructions) endpoint response type is same as File API response type 'RetrievalInstructionsResponse', hence this endpoint is returning 200 success response for the same request.
Solution
To generate 'GetDatasetRetrievalInstructionsResponse' from 'RetrievalInstructionsResponse' instead of directly deserializing it.