- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Description
Set a custom field to a value on a specified collection.
URL parameters
URL parameter ordering
The URL parameters below are listed in the order they should be entered in the API URL.
Name | Required | Type | Description |
---|---|---|---|
CollectionID | True | string | Collection ID number. |
CustomFieldName | True | string | Name of the custom field. |
CustomFieldValue | False | string | Value for the custom field. If excluded, the value will return to the default value for the account. |
Request body (optional)
The collections and values of the custom field you want to edit in bulk. You can format these in XML or JSON.
Custom Field Bulk Edit
When updating in bulk you still must specify the single custom field you are working with but can specify multiple CollectionID
's and different values.
XML
Name | Required | Type | Description |
---|---|---|---|
File | False | XML | A file containing the collections with values for the custom field. POST using Content-Type multipart/form-data . |
<ItemList>
<Item>
<CollectionID>1005</CollectionID>
<Value>asd</Value>
</Item>
<Item>
<CollectionID>1006</CollectionID>
<Value>Vasd</Value>
</Item>
<Item>
<CollectionID>1004</CollectionID>
<Value>Value4</Value>
</Item>
</ItemList>
JSON
Name | Required | Type | Description |
---|---|---|---|
POSTDATA | False | JSON | JSON array of collections with values for the custom field. POST using Content-Type application/x-www-form-urlencoded . |
[
{ "CollectionID": "1002", "value": "update2" },
{ "CollectionID": "1003", "Value": "update3" },
{ "CollectionID": "1004", "Value": "update4" },
{ "CollectionID": "1005", "Value": "update5" }
]
Responses
Name | Type | Description |
---|---|---|
Result | string | Success if the operation was successful. |
CollectionID | string | Collection ID number. |
<FieldName> * | string | The set value for the field. |
*When the user sends a bulk request, it will return an ItemList with each CollectionID
and <FieldName>
.
Sample requests
GET
with collection, custom field and value specified in the URL
curl -X GET 'https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Collection.SetCustomField&CollectionID=1022&CustomFieldName=TestBoy&CustomFieldValue=test'
POST
- XML body
curl -X POST 'https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Collection.SetCustomField&CustomFieldName=TestBoy'
-F 'file=@/path/to/file.xml'
POST
- JSON body
curl -X POST 'https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=Collection.SetCustomField&CustomFieldName=TestBoy'''
-d '[ { "CollectionID": "1002", "value": "update2" }, { "CollectionID": "1003", "Value": "update3" }]'
Sample responses
XML
<?xml version="1.0" encoding="utf-8"?>
<CollectionSetCustomFieldResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Result>Success</Result>
<ItemList>
<Item>
<CollectionID>1002</CollectionID>
<myfield>update2</myfield>
</Item>
<Item>
<CollectionID>1003</CollectionID>
<myfield>update3</myfield>
</Item>
<Item>
<CollectionID>1004</CollectionID>
<myfield>update4</myfield>
</Item>
<Item>
<CollectionID>1005</CollectionID>
<myfield>update5</myfield>
</Item>
</ItemList>
</CollectionSetCustomFieldResponse>
JSON (add &ResponseFormat=JSON
)
{
"CollectionID":1022,
"TestBoy":"test",
"JsonResult":{
"Command":"Collection.SetCustomField",
"AutoLoggedIn":false,
"WebConsoleKey":"",
"Result":"Success",
"ErrorCode":"",
"ErrorDescription":"",
"ErrorList":[
],
"ExecutionTime":{
"Ticks":0,
"Days":0,
"Hours":0,
"Milliseconds":0,
"Minutes":0,
"Seconds":0,
"TotalDays":0,
"TotalHours":0,
"TotalMilliseconds":0,
"TotalMinutes":0,
"TotalSeconds":0
}
}
}
Was this article helpful?