Search code examples
formsrestpostmancircuit-sdk

How to send a form with just 1 TextBox and 1 Button via Postman


I tried creating a request via postman with below Request Body with 1 input text,

{
    "subject" : "Fill Up the Form",
    "content" : "Form Data",
    "formMetaData" : {
      "id": "myform1234",
      "controls": [{
        "type": "Circuit.Enums.FormControlType.INPUT",
        "name": "Your Name"
      }]
    } 
}

But I am only getting the Content and Subject part in Circuit Sandbox. Form part is missing


Solution

  • Using the Rest API and not the SDK you should replace the ENUMS with strings for the control types.

    I have a working code sample in Postman for this

    curl -X POST \
      https://beta.circuit.com/rest/v2/conversations/6aecff9e-1aa0-46f3-8e24-8519e2956291/messages \
      -H 'Authorization: Bearer 11111omitted' \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      -F 'content=Please fill in the form below' \
      -F 'subject=Test form' \
      -F 'formMetaData={"id":"myformonbeta","title":"Test Form","controls":[{"type":"INPUT","name":"name","text":"What is your namne ?","rows":1},{"type":"BUTTON","text":"Send"}]}'
    

    Hope this helps