I am forming a request to create a record using the example of “curl “$ComposeAPI/namespace/$NAMESPACE_ID/module/$MODULE_ID/record/”
-H"Authorization: Bearer $JWT”
-H ‘Content-Type:application/json’
–data-binary “{
"values": [
{ "name": "$FIELD1", "value": "$VALUE1" },
{ "name": "$FIELD2", "value": "$VALUE2" }
]
}”;"
the response from the server comes that the field does not exist. Please tell me where to find or view the existing fields? To send a POST request, I could create a new record
1 Like
Hi,
the easiest way to test how to send data is checking out our requests via the webapp, in this case the compose.
Here is an example of a Task record being created, what I did was:
- go to Tasks record page
- created a new Record
- opened up the web developer toolbar
- checked the payload of the POST request
If you export this as curl (some stuff redacted):
curl 'https://localinstance/api/compose/namespace/361869359469756418/module/361869359515172866/record/' \
-H 'accept: application/json, text/plain, */*' \
-H 'authorization: Bearer FOO' \
-H 'content-type: application/json' \
--data-raw '{"values":[{"name":"OwnerId","value":"666"},{"name":"Subject","value":"Tis a value"}],"records":[],"meta":{}}'
You can find the existing fields in the administration of the module in compose, or you can call the api to fetch the structure of the module:
curl 'https://localinstance/api/compose/namespace/${NAMESPACE_ID}/module/?sort=name+ASC' \
-H 'accept: application/json, text/plain, */*' \
-H 'authorization: Bearer FOO'
You can find your module in the list then.
3 Likes
Also there are api docs on Corteza Server REST API Documentation that you can get to via our documentation page.
1 Like