Rest API to collect form details (JSON Data) of a process Deployed in Camunda could platform 8

I am trying to get the form details as JSON that are exist in the process that is deployed in Camunda cloud 8 platform , Earlier we have an Api in Camunda 7 to fetch the Form details I.e… JSON of the forms (localhost:8080/task/{id}/form-variables),

now I need an API or any other way to get the Form details to get the All Form Details as JSON of a Process that is deployed in Camunda 8.

Help will be much Appreciated.!

Hi @shivu , welcome to the forum!

You can obtain the form using this endpoint: Form API | Camunda Platform 8 Docs

You need both the form ID and the process definition key to get the form that is embedded in that process.

Let me know if you need further help!

Hi @christian-konrad , Thank you for the response , I had already tried this end point that you have referred, But the Schema that it will provide is Not a JSON format, wanted to to shw you the schema to you as well
here it is the sample response

{
“id”: “UserTaskForm_0er2a5g”,
“processDefinitionKey”: “2251799814478700”,
“schema”: “{\n "components": [\n {\n "label": "Offer Name",\n "type": "textfield",\n "layout": {\n "row": "Row_1ft7ca2",\n "columns": null\n },\n "id": "Field_1y0p9uv",\n "key": "field_0gibz81",\n "description": "Enter Offer Name"\n },\n {\n "label": "Owner of the Offer",\n "type": "textfield",\n "layout": {\n "row": "Row_0h9uvbi",\n "columns": null\n },\n "id": "Field_16nqkt5",\n "key": "field_15vuol4",\n "description": "Enter Name"\n },\n {\n "action": "submit",\n "label": "Create",\n "type": "button",\n "layout": {\n "row": "Row_1hr4t0s",\n "columns": null\n },\n "id": "Field_1ntrduc",\n "key": "field_07x50hs"\n },\n {\n "action": "reset",\n "label": "Cancel",\n "type": "button",\n "layout": {\n "row": "Row_1hr4t0s",\n "columns": null\n },\n "id": "Field_1988x1f",\n "key": "field_1o6l8yr"\n }\n ],\n "schemaVersion": 9,\n "exporter": {\n "name": "Camunda Web Modeler",\n "version": "25d1ba4"\n },\n "type": "default",\n "id": "create-offer-0l2uffw",\n "executionPlatform": "Camunda Cloud",\n "executionPlatformVersion": "8.2.0"\n}”
}

In Order to automate I need it as above Schema as JSON, And , I have an Obstacle here, how can we find the Form ID and Process Definition key through some API or Any other way in order to automate it,

After converting all the \n to either null or \r\n, the “schema” portion loads into modeler 4.9.0 without issue for me, generating a form with two fields and two buttons. Is that what you were expecting to see?

1 Like

Exactly, you have to extract the schema and JSON.parse it

After Integrating the above Response From the API with the React Code , I am Getting the CORS error , Can you Tell Me how to resolve this Issue. @christian-konrad @GotnOGuts please help me out to solve this.)>

@shivu the API does not support CORS, meaning it can only be consumed by backend, not a browser. You need to consume it in a backend first, then pass it to your UI. This is due to security implications.

Thanks for Quick Assist, You guys are really awesome!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.