Closed AndreaSanchezTapia closed 4 months ago
I am running the example query for insights from Postman with no problem. In R, the JSON string to the body of the request is correctly formatted:
{ "includes": ["GAP"], "startDate": "2022-07-11", "endDate": "2023-07-11", "vessels": [ { "datasetId": "public-global-vessel-identity:latest", "vesselId": "2339c52c3-3a84-1603-f968-d8890f23e1ed" } ] }
When I run it I am not being able to sort out 422:
> devtools::load_all() ℹ Loading gfwr > a <- get_insights(includes = "GAP", + startDate = "2022-07-11", + endDate = "2023-07-11", + vessels = "2339c52c3-3a84-1603-f968-d8890f23e1ed", + key = key2) <httr2_request> POST https://gateway.api.globalfishingwatch.org/v3/insights/vessels Headers: • Authorization: '<REDACTED>' • Origin: 'https://globalfishingwatch.org' • Referer: 'https://globalfishingwatch.org' Body: json encoded data Error in `httr2::req_perform()` at gfwr/R/get_insights.R:63:0: ! HTTP 422 Unprocessable Entity. Run `rlang::last_trace()` to see where the error occurred.
httr2::req_user_agent(gfw_user_agent())
Leaving this here in case you've handled similar errors.
Closing this one as I talked to the eng team and we have better understanding of API body requests
I am running the example query for insights from Postman with no problem. In R, the JSON string to the body of the request is correctly formatted:
When I run it I am not being able to sort out 422:
httr2::req_user_agent(gfw_user_agent())
Leaving this here in case you've handled similar errors.