Integratec API Platform
resourceAdd

Adds a resource to a collection.

There are multiple variations of this method:

string resourceAdd(array resourceId, object resource)

Parameters
[in]resourceIdResource ID of the collection to add a resource to.
[in]resourceJSON 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(
2  [ 'companies' ],
3  '{ \
4  "name" : "BCC Software", \
5  "ADDRESS" : "75 Josons Dr", \
6  "CITY" : "Rochester", \
7  "STATE" : "NY", \
8  "ZIP" : "14623" \
9  }'
10 )

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]resourceIdResource ID of the collection to add a resource to.
[in]namesProperty names of the JSON object representation of the resource to add.
[in]valuesProperty 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(
2  [ 'companies' ],
3  [ 'name', 'ADDRESS', 'CITY', 'STATE', 'ZIP' ],
4  [ 'BCC Software', '75 Josons Dr', 'Rochester', 'NY', '14623' ]
5 )

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]resourceIdResource ID of the collection to add resources to.
[in]resourcesJSON 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(
2  [ 'companies' ],
3  [
4  '{ \
5  "name" : "BCC Software", \
6  "ADDRESS" : "75 Josons Dr", \
7  "CITY" : "Rochester", \
8  "STATE" : "NY", \
9  "ZIP" : "14623" \
10  }',
11  '{ \
12  "name" : "XYZ Company", \
13  "ADDRESS" : "1 Main St, \
14  "CITY" : "Anytown", \
15  "STATE" : "NY", \
16  "ZIP" : "12345" \
17  }'
18  ]
19 )

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"
]
}