Adds a resource to a collection.
There are multiple variations of this method:
string resourceAdd(array resourceId, object resource)
- Parameters
-
[in] | resourceId | Resource ID of the collection to add a resource to. |
[in] | resource | JSON object representation of the resource to add. |
- Returns
- The return value is the id or bookmark of the new resource.
- Usage
- The resource being added to must be a collection.
- Properties that are not specified are initialized to
null
. If a property is required, it must be given a value other than null
.
Examples
C#
jsonReply = call.resourceAdd(
new string[] { "companies" },
"{" +
"\"name\" : \"BCC Software\", " +
"\"ADDRESS\" : \"75 Josons Dr\", " +
"\"CITY\" : \"Rochester\", " +
"\"STATE\" : \"NY\", " +
"\"ZIP\" : \"14623\" " +
"}"
);
Python
1 jsonReply = call.resourceAdd(
4 "name" : "BCC Software", \ 5 "ADDRESS" : "75 Josons Dr", \ 6 "CITY" : "Rochester", \ Request
{
"method" : "resourceAdd",
"params" : [
[ "companies" ],
{
"name" : "BCC Software",
"ADDRESS" : "75 Josons Dr",
"CITY" : "Rochester",
"STATE" : "NY",
"ZIP" : "14623"
}
]
}
Reply
{
"result" : "1234567890"
}
string resourceAdd(array resourceId, array names, array values)
- Parameters
-
[in] | resourceId | Resource ID of the collection to add a resource to. |
[in] | names | Property names of the JSON object representation of the resource to add. |
[in] | values | Property values of the JSON object representation of the resource to add. |
- Returns
- The return value is the id or bookmark of the new resource.
- Usage
- The resource being added to must be a collection.
- Properties that are not specified are initialized to
null
. If a property is required, it must be given a value other than null
.
Examples
C#
jsonReply = call.resourceAdd(
new string[] { "companies" },
new string[] { "name", "ADDRESS", "CITY", "STATE", "ZIP" },
new string[] { "BCC Software", "75 Josons Dr", "Rochester", "NY", "14623" }
);
Python
1 jsonReply = call.resourceAdd(
3 [
'name',
'ADDRESS',
'CITY',
'STATE',
'ZIP' ],
4 [
'BCC Software',
'75 Josons Dr',
'Rochester',
'NY',
'14623' ]
Request
{
"method" : "resourceAdd",
"params" : [
[ "companies" ],
[ "name", "ADDRESS", "CITY", "STATE", "ZIP" ],
[ "BCC Software", "75 Josons Dr", "Rochester", "NY", "14623" ]
]
}
Reply
{
"result" : "1234567890"
}
array resourceAdd(array resourceId, array resources)
- Parameters
-
[in] | resourceId | Resource ID of the collection to add resources to. |
[in] | resources | JSON array of object representations of the resource to add. |
- Returns
- The return value is an array of the ids or bookmarks of the new resources.
- Usage
- The resource being added to must be a collection.
- Properties that are not specified are initialized to
null
. If a property is required, it must be given a value other than null
.
Examples
C#
jsonReply = call.resourceAdd(
new string[] { "companies" },
"[" +
"{" +
"\"name\" : \"BCC Software\", " +
"\"ADDRESS\" : \"75 Josons Dr\", " +
"\"CITY\" : \"Rochester\", " +
"\"STATE\" : \"NY\", " +
"\"ZIP\" : \"14623\" " +
"}," +
"{" +
"\"name\" : \"XYZ Company\", " +
"\"ADDRESS\" : \"1 Main St\", " +
"\"CITY\" : \"Anytown\", " +
"\"STATE\" : \"NY\", " +
"\"ZIP\" : \"12345\" " +
"}" +
"]"
);
Python
1 jsonReply = call.resourceAdd(
5 "name" : "BCC Software", \ 6 "ADDRESS" : "75 Josons Dr", \ 7 "CITY" : "Rochester", \ 12 "name" : "XYZ Company", \ 13 "ADDRESS" : "1 Main St, \ Request
{
"method" : "resourceAdd",
"params" : [
[ "companies" ],
[
{
"name" : "BCC Software",
"ADDRESS" : "75 Josons Dr",
"CITY" : "Anytown",
"STATE" : "NY",
"ZIP" : "14623"
},
{
"name" : "XYZ Company",
"ADDRESS" : "1 Main St",
"CITY" : "Rochester",
"STATE" : "NY",
"ZIP" : "12345"
}
]
]
}
Reply
{
"result" : [
"1234567890",
"1234567891"
]
}