Add Organisation and History

25 views
Skip to first unread message

Matthew Bristow

unread,
Jan 3, 2019, 10:06:08 AM1/3/19
to Capsule API
Hello,

On API v1 you could add organisations. There does not seem to be the option to this on v2 or not mentioned on the documentation.

The same applies for adding History and Notes. Can this be done in v2?

Ben Dale

unread,
Jan 3, 2019, 10:15:08 AM1/3/19
to Capsule API
Hi Matthew,

Documentation for creating a Party can be found here. The Party object definition documents that the "type" field can be either "person" or "organisation".

"History" in V1 is known as "Entries" in V2 and documentation around creating, reading, updating and deleting entries can be found here.

Let me know if you have any more questions!

Thanks,

Ben

Matthew Bristow

unread,
Jan 3, 2019, 10:45:06 AM1/3/19
to Capsule API
Hi Ben,

Thank you for the quick response!

Once I create a party with a "type": "organisation", will "id" be randomly generated? 

I see if an organisation is linked to a person, then the "id" is the same.

Thanks,
Matt


will an "id" be generated randomly or will it be the same ID once I've done

Ben Dale

unread,
Jan 3, 2019, 11:06:44 AM1/3/19
to Capsule API
Hi Matt,

Once you create a party a numeric ID will be assigned automatically. If you try to create an organisation using the name of an organisation that already exists you will get a 422 response as Capsule does not allow duplicate organisations. 

Take the following request for example, creating a person with an organisation:

curl -i \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
    "party": {
      "type": "person",
      "firstName": "Sarah",
      "lastName": "White",
      "organisation": { "name": "Google" }
    }
}' \

If the organisation "Google" already exists then Sarah White will be created and placed in the existing organisation. If "Google" doesn't exist it will be created along with Sarah White.

I hope that all makes sense!

Thanks,

Ben
Reply all
Reply to author
Forward
0 new messages