I've built an external adapter for an API and deployed it as a cloud function on GCP. However, when I send a Curl command to the deployed external adapter, it returns an error 422. Below are the docs for the API I'm trying to reach, the code for the external adapter, and the curl command I am sending. I've been following this tutorial and using the template they provide here : https://blog.chain.link/build-and-use-external-adapters/ Can anyone spot where the problem is and how to fix it to get data back from the adapter?
API docs (I'm trying to reach the 'statistics' endpoint): https://shamba-gateway-staging-2ycmet71.ew.gateway.dev/geoapi/v1/docs
External Adapter code:
https://github.com/shambadynamic/meanExternalAdapter/blob/main/index.js
Link to the deployed external adapter with the code above:
https://europe-west6-shamba-vpc-host-nonprod.cloudfunctions.net/geoEA-mean
Curl Command I am sending:
curl -X POST -H "content-type:application/json" "https://europe-west6-shamba-vpc-host-nonprod.cloudfunctions.net/geoEA-mean" --data '{ "id": 0, "data": {"dataset_code":"COPERNICUS/S2_SR", "selected_band":"NDVI", "image_scale":250.0, "start_date":"2021-09-01", "end_date":"2021-09-10", "geometry":{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[19.51171875,4.214943141390651],[18.28125,-4.740675384778361],[26.894531249999996,-4.565473550710278],[27.24609375,1.2303741774326145],[19.51171875,4.214943141390651]]]}}]}} }'
Error message I am getting from sending the above curl command:
"name":"AdapterError","message":"Request failed with status code 422"