Reference : REST XML API reference : Element collection : POST method
  
POST method
Use the POST method to create a new element in a module.
The following example uses the POST method to create new elements where the user must have administrator permission for creating elements in the module.
URL: https://fpserver.com:9443/fp/resources/workspaces/3/modules/1/elements/.xml
Accept header: application/xml
Request body:
<ns:newElement xmlns:ns="https://fpserver.com:9443/fp/namespace/workspaces/3/modules/1/elements" xmlns:fp="http://schema.ibm.com/focalpoint/resources" > <ns:Title> <fp:textValue xmlns:fp="http://schema.ibm.com/focalpoint/resources">karthi 1</fp:textValue> </ns:Title> <ns:MealPreference value="NonVeg"></ns:MealPreference> <ns:type_is_a_folder value="true"></ns:type_is_a_folder> <ns:Comments> <ns:newTextListEntry> <fp:textValue xmlns:fp="http://schema.ibm.com/focalpoint/resources">text entry 1</fp:textValue> </ns:newTextListEntry> <ns:newTextListEntry> <fp:textValue xmlns:fp="http://schema.ibm.com/focalpoint/resources">text entry 2</fp:textValue> </ns:newTextListEntry> </ns:Comments> <ns:RelatedReleases> <fp:linkChange value="https://fpserver.com:9443/fp/resources/workspaces/3/modules/3/elements/40"></fp:linkChange> <fp:linkChange value="https://fpserver.com:9443/fp/resources/workspaces/3/modules/3/elements/41"></fp:linkChange> </ns:RelatedReleases><ns:Parent_Folder value="https://fpserver.com:9443/fp/resources/workspaces/3/modules/1/elements/61"></ns:Parent_Folder> </ns:newElement>
The root node <ns:newElement> is based on the module name. For example: if the module name is products, then the new element is product.
Supported parameters for the POST method
The following parameters can be used with the POST method:
optimize
Set the optimize parameter to true to optimize element creation.
Type: Boolean
Using the POST method with the view parameter
The following example shows the method that allows non-administrators to create new elements by using the view parameter.
URL: https://fpserver.com:9443/fp/resources/workspaces/3/modules/1/elements/.xml?view=200&optimize=true
Accept header: application/xml
Request body:
<ns:newElement xmlns:ns="https://fpserver.com:9443/fp/namespace/workspaces/3/modules/1/views/200/elements" xmlns:fp="http://schema.ibm.com/focalpoint/resources" > ... </ns:newElement>
The root node (<ns:newElement>) is based on the module name. For example: if the module name is products, then the new element is product.
Multipart POST method
The following example uses the POST method to update multiple attributes through one HTTP request. The content type for this request is multipart/related. You can use the POST method only to add or delete element links.
URL: https://fpserver.com:9443/fp/resources/workspaces/5/modules/1/elements/.xml
Accept header: application/xml
Content type: multipart/related
Request body:
<attributeChangeCollection xmlns:ns="https://schema.com/focalpoint/resources" > <linkListChange href="/14/attributes/224"> <ns:addLink value="https://fpserver.com:9443/fp/resources/workspaces/5/modules/3/elements/20"></ns:addLink> <ns:addLink value="https://fpserver.com:9443/fp/resources/workspaces/5/modules/3/elements/19"></ns:addLink> <ns:deleteLink value="https://fpserver.com:9443/fp/resources/workspaces/5/modules/3/elements/18"></ns:deleteLink> </linkListChange> <textListEntryChange href="./14/attributes/223/entries/" > <ns:textValue>one</ns:textValue> </textListEntryChange> </attributeChangeCollection >
Go up to
Element collection