PublishFormXml
Publishes the XML-encoded definition of a Nintex form for the specified SharePoint list and content type.
Request
Method | Request URI | HTTP Version |
---|---|---|
POST | {endpointURL}/PublishFormXml | HTTP/1.1 |
Request Parameters
Request Parameter | Description |
---|---|
endpointURL | Required. The endpoint URL for the REST API. For more information about the endpoint URL, see Endpoint URL. |
Request Headers
The following table describes required and optional request headers.
Request Header | Description |
---|---|
Content-Type |
Required. application/json |
X-RequestDigest |
Required. SharePoint form digest value, used to authenticate the request. |
Request Body
An object, serialized in JavaScript Object Notation (JSON), that contains the following properties:
Property | Data type | Description |
---|---|---|
contentTypeId | string | Optional. The name or identifier of the SharePoint content type. If a value is specified that cannot be matched to a valid content type for the list specified in listId, an error occurs. If a value is not specified, the first content type defined for the list specified in listId is used. |
formXml | string | Required. The XML-encoded definition of a Nintex form. If this value is not specified, or if the value does not represent a valid XML-encoded Nintex form definition, an error occurs. |
listId | string | Required. The name or identifier of the SharePoint list or document library. If this value does not identify an existing SharePoint list or document library, an error occurs. |
Response
The response includes an HTTP status code, header values, and a response body.
Response Codes
Code | Description |
---|---|
200 | The specified form was deleted. |
400 | An invalid operation has occurred. |
401 | An invalid request body was specified. |
404 | The specified form could not be found. |
500 | Internal error. |
Response Headers
The following table describes response headers returned by a successful response. Other header values may also be returned, depending on SharePoint and ASP.NET configurations.
Request Header | Description |
---|---|
Content-Type |
application/json; charset=utf-8 |
Content-Length |
The length, in characters, of the response body. |
Cache-Control |
private |
Response Body
If the method was successful, and the Nintex form definition was successfully published, a JSON-serialized FormSaveInfo object is returned that contains the following properties:
Property | Data type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Url | string |
A JSON-encoded string that represents a JSON object which contains the following properties:
|
||||||||||||||||||||||||
Version | string |
The version number of the Nintex form, in the following format, where <Major> is the major version number and <Minor> is the minor version number: <Major>.<Minor> |
If the method was successful, but the Nintex form definition was not successfully published, a JSON-serialized null reference is returned.
Otherwise, depending on the error, the method returns additional information about the error. For example, if the value of the listId property in the request body is set to a name or identifier that cannot be found on the SharePoint site, the response returns an HTTP 400 status code and a Request Error web page in which the error indicates that a list with the specified name does not exist.
Remarks
This method is implemented so that message bodies for requests must be provided as wrapped JSON, but message bodies for responses are provided as unwrapped JSON.
This method validates the form and, depending on whether Nintex Live Forms is enabled, configures the form to ensure compatibility. The form is saved, published, and then the relevant metadata for the published form is returned in the response body.
Example
The following example demonstrates how to use this operation to publish the definition of a Nintex form to a SharePoint list.
Request
The following POST request attempts to publish the definition of a Nintex form.
http://crestan.com/_vti_bin/NintexFormsServices/NfRestService.svc/PublishFormXml
Request Body
The following request body contains a JSON object in which the listId property is set to the identifier of the SharePoint list to which to publish the form definition. The contentTypeId property is not specified.
Note: The contents of the response body have been edited for readability. Content has been replaced with an ellipsis (...) and line breaks have been added.
{ "listId": "{DB0ECEE6-117D-4519-986E-020A9BE6A7E3}", "formXml": "<?xml version=\"1.0\" encoding=\"utf-16\"?>...</Form>" }
Response
An HTTP 200 response code is returned, indicating that the form was successfully published, and a response body containing metadata for the published form.
Response Body
The following response body contains a JSON-serialized FormSaveInfo object, which contains metadata about the published Nintex form. In this example, the Nintex form was published to a SharePoint site for which Nintex Live Forms is not enabled.
Note: The contents of the response body have been edited for readability. Content has been replaced with an ellipsis (...) and line breaks have been added.
{ "Url": "{\"Publish\":false,\"Url\":null,\"ShortUrl\":null,\"Error\":null,\"ListDefaultViewUrl\":\"/Lists/Test List/AllItems.aspx\",\"User\":null,\"ShortenUrl\":true}", "Version": "1.0" }