Account Collections

Using an account collection, you can place accounts of particular interest into a list. By means of the following web service calls, these account lists can be queried, and accounts can be added to or removed from them.

Retrieving All the Account IDs of an Account Collection

curl http://hostname/webservice/account_collections/id \
  -u webservice:apikey

As the result, the list of the account IDs contained in the collection, which is referenced by its ID in the URL, is returned:

<?xml version="1.0" encoding="UTF-8"?>
<collection>
  <title>Top Companies</title>
  <id type="integer">id</id>
  <account_ids type="array">
    <account_id type="integer">3</account_id>
    ...
  </account_ids>
</collection>

For further details about accounts please refer to the documentation of account fields and web services for accounts.

Adding Accounts to an Account Collection

To add accounts via their IDs to a collection, use the following web service:

curl http://hostname/webservice/account_collections/id/add_account_ids \
  -u webservice:apikey \
  -X POST \
  --form-string account_ids[]=2 \
  --form-string account_ids[]=15 \
  --form-string account_ids[]=21

The response is a message stating the number of accounts added:

<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <count type="integer">3</count>
  <message>Added 3 account(s) to collection.</message>
</hash>

If IDs are passed as parameters that do not refer to accounts, these IDs will be ignored.

Removing Accounts from a Collection

curl http://hostname/webservice/account_collections/id/remove_account_ids \
  -u webservice:apikey \
  -X POST \
  --form-string account_ids[]=3 \
  --form-string account_ids[]=16 \
  --form-string account_ids[]=23

The response is a message stating the number of accounts removed:

<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <count type="integer">1</count>
  <message>Removed 1 account(s) from collection.</message>
</hash>

If IDs are passed as parameters that do not refer to accounts, these IDs will be ignored.