Hi, I am trying to create an IP address via a payload to whitelist it, as I am developing an API. I have a C# app that I created, and I’m receiving the same message as the one below when I use cURL. I was using this as a test to see if I can create the IP address. I’m wondering if anyone is doing something similar, as I don’t want to keep logging in to Atlas to create the IP address each time. Does anyone know why I am getting the error below?
curl --user “user:password” --digest --include
–header “Accept: application/json”
–header “Content-Type: application/json”
–request POST
–data ‘{
“ipAddress”: “192.168.0.22”,
“comment”: “test by terry”
}’ https://cloud.mongodb.com/api/atlas/v1.0/groups/groupid/accessList
I get this error any ideas
{“detail”:“Received JSON does not match expected format.”,“error”:400,“errorCode”:“INVALID_JSON”,“parameters”:,“rason”:“Bad Request”}
To add an IP address using a JSON payload via an API in MongoDB, you typically need to send a POST request to the appropriate endpoint with your IP data formatted correctly in JSON. Make sure your API accepts the IP field and the payload matches the expected schema. If you’re using MongoDB’s REST API or a custom API, check the documentation for the exact field names and required headers. Also, ensure your API key or authentication method is correctly set up to allow write operations.