Open alexralph opened 2 years ago
Hi, @alexralph. That should be easily accomplished by putting the data element in your data like so:
resource "restapi_object" "post_request" {
path = "/webservices/rest.php?version=1.2"
data = "{\"json_data\": {\"operation\": \"core/create\", <remaining valid json removed for clarity>}}"
}
Have you tried this kind of approach yet?
Thanks @DRuggeri - yes I had already tried this - it produces the same error.
I assume that the provider is putting the data
value into the POST body, but I think that the iTop API is expecting a parameterised url like /uri/path&json_data="{JSON-string}"
Ah - I understand what you mean. Yes, if it is expecting a param in the URL, the provider won't be able to be of much help, unfortunately.
If you're curious about the exact data that goes to/from the API, you can always observe the contents by using debug mode (quick howto is in the readme)
When I use the Mastercard/terraform-provider-restapi and I send json data using the resource I receive an error back from theiTop api: "{"code":3,"message":"Error: Missing parameter 'json_data'"}: timestamp=2022-06-30T10:51:01.012+0100" So it seems that the API I am trying to send the json data to is expecting a json_data parameter. Any idea how to get this provider/resource to send the json data using a json_data parameter is a change needed to support this or can the provider do this in some way?
Here is my code: