Back to All

Struggling with creating a form via api

I am using Zoho Deluge to create a form on goFormz, however i keep getting 415 error. I am not sure what I am doing wrong here? I followed the api documentation:


user = map();
user.put("id", "3d4461c8-1c6d-4fdg-8594-a57700bb3335b"); // Assignment user ID
user.put("type", "user"); // Assignment type (fixed capitalization)

// Define the fields
fields = map();
fields.put("Name", "testing data"); // Add the field 'Name' with its value

// Define the payload
payload = map();
payload.put("name", "Test Form"); // Form name
payload.put("overrideDefaultFormName", true); // Enable override
payload.put("templateId", "5a65b775-4f8e-48e5-a968-03a9f3ebe957"); // Template ID
payload.put("assignment", user); // Add assignment details
payload.put("fields", fields); // Add fields to the form


header = Map();
header.put("accept","application/json");
header.put("Authorization","Bearer " + access_token);

// Make the API request
response = invokeUrl
[
url : "https://api.goformz.com/v2/formz"
type : POST
parameters : payload.toString()
headers: header
];

// Log the response
info response;