Can't get list of form definitions by REST API call

Hi,

I tried to get list of form definitions by REST API call, follow the Flowable Form DOCS, but I got only error response status 404.

/flowable-task/form-api/form-repository/form-definitions

This is the URL described in DOCS. Is there any wrong?

Hi.

You’re correct. The form definitions resource has the wrong mapping.
I’ve corrected it. In the next release it will be as described in the docs.

For now you can access the resource with;

/form-repository/forms

Thanks for pointing it out.

Regards,

Yvo

Hi yvo,

Thank you for your help.
I could get the response as following by your method.

data: [
{
id: “5a8ec453-3c9c-11e7-a5ba-000c294040d3”,
url: “http://localhost:8080/flowable-task/form-api/form-repository/forms/5a8ec453-3c9c-11e7-a5ba-000c294040d3”,
category: null,

}

Would you mind helping me about one more thing?

I want to get the Form Model JSON Codes finally by REST, to show rendered HTML forms on my external web app.

Then I am trying to get a Form Model by FormDefinition(as described here), but I think this also must be corrected as you’ve shown. So, it should look like the following:

/form-repository/forms/{formDefinitionId}/model

Actually, Form Definition resource locator had been already specified in the response data as bellow.

url: “http://localhost:8080/flowable-task/form-api/form-repository/forms/5a8ec453-3c9c-11e7-a5ba-000c294040d3

But… this URL always unfortunately returns status 404…

Would you show me the correct way to locate the Form Model resource with FormDefinition?

Incidentally, I found the Form Model JSON Code in the ACT_DE_MODEL table. That’s precisely what I want to get by REST Call.

Regards,

hermid

Hi.

I can imagine it’s a bit confusing. But the only the form definitions collection resource had the wrong mapping.
The other ones; like the form model by form definition; are as described in the docs.
Did you try that?

/form-repository/form-definitions/{formDefinitionId}/model

should get you the json form model.

Regards,

Yvo

Hi,

Sorry. I didn’t notice… Now I made sure that, I can get JSON by the URL you’ve shown. Thank you for letting me know.

However, if so, I think the response of /form-repository/forms is currently showing wrong resource location.

data: [
{
id: “5a8ec453-3c9c-11e7-a5ba-000c294040d3”,
url: “http://localhost:8080/flowable-task/form-api**/form-repository/forms**/5a8ec453-3c9c-11e7-a5ba-000c294040d3”,
category: null,

}

This URL returns 404. The correct URL should be as following?

http://localhost:8080/flowable-task/form-api**/form-repository/form-definitions**/5a8ec453-3c9c

It seems that exactly same wrong is in the response of /form-repository/form-definitions/{formDefinitionId}. Would you please confirm these?

Regards,

hermid

Hi Yvo,

Please take a look at FormRestUrls.java

public static final String SEGMENT_FORMS_RESOURCES = "forms";
....
/**
 * URL template for a form collection: <i>/form-repository/forms/{0:formId}</i>
 */
public static final String[] URL_FORM_COLLECTION = { SEGMENT_REPOSITORY_RESOURCES, SEGMENT_FORMS_RESOURCES };
/**
 * URL template for a single form: <i>/form-repository/forms/{0:formId}</i>
 */
public static final String[] URL_FORM = { SEGMENT_REPOSITORY_RESOURCES, SEGMENT_FORMS_RESOURCES, "{0}" };
/**
 * URL template for a single form model: <i>/form-repository/forms/{0:formId}/model</i>
 */
public static final String[] URL_FORM_MODEL = { SEGMENT_REPOSITORY_RESOURCES, SEGMENT_FORM_RESOURCES, "{0}", SEGMENT_FORM_MODEL };
/**
 * URL template for the resource of a single form: <i>/form-repository/forms/{0:formId}/resourcedata</i>
 */
public static final String[] URL_FORM_RESOURCE_CONTENT = { SEGMENT_REPOSITORY_RESOURCES, SEGMENT_FORM_RESOURCES, "{0}", SEGMENT_DEPLOYMENT_ARTIFACT_RESOURCE_CONTENT };

I think plobably that SEGMENT_FORMS_RESOURCES should be set “form-definitions” instead of “forms”.
(Also the [i tag] in the comment of these methods.)

Hi,

yes. Now that the resource mapping has changed this will be change too.

Regards,

Yvo