Create
From API Documentation
Use create to create one or more objects of a specific type. You can specify different types in different create calls, but each create call must only apply to one type of object.
Contents |
Syntax and Argument
SaveResult[] = create(zObject[])
The argument is as shown in the following table. For information on the field types, see Field Types.
| Argument | Description |
|---|---|
| zObject[] | An array of one or more objects of type zObject. |
Using This Call
You can call create on an array of one or more zObjects. It returns an array of SaveResults indicating the success or failure of creating each object. The following information applies to this call:
- You cannot pass in any null zObjects.
- You can pass in a maximum of 50 zObjects at a time.
- All objects on create must be of the same type.
- SaveResult should be in the Response section of create.
Important: Both the create and subscribe calls will create a new account; however, there are differences.you won't be able to create a subscription for that account.
- If you want to create an account without creating a subscription, use the create call. If you use create to create an account,
- If you want to create the account along with the subscription and the initial payment information, use the subscribe call.
Response
Faults
Sample Code
// create account
Account acc = new Account();
acc.setName("Test Account");
acc.setBatch("Batch1");
acc.setBillCycleDay(1);
acc.setAllowInvoiceEdit(true);
acc.setCurrency("USD");
acc.setStatus("Draft");
ZObject[] objs = new ZObject[1];
objs[0] = acc;
Create create = new Create();
create.setZObjects(objs);
CreateResponse resp = stub.create(create, this.header);
SaveResult[] res = resp.getResult();
ID accountId = res[0].getId();