Capsule API

Opportunity API

Data Reference

Opportunity

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<opportunity>
    <
id>43</id> <!-- integer -->
    <
name>Consulting</name> <!-- required -->
    <
description>Scope and design web site shopping cart</description>
    <
partyId>2</partyId> <!-- integerread-only -->
    <
currency>GBP</currency> <!-- ISO currency code -->
    <
value>500.00</value
    <
durationBasis>DAY</durationBasis
        <!-- 
defaulted to FIXED HOUR DAY MONTH YEAR -->
    <
duration>10</duration> <!-- required if duration basis not FIXED -->
    <
expectedCloseDate>2009-09-30T00:00:00Z</expectedCloseDate>
    <
milestone>Bid</milestone> <!-- requiredsee help for options -->
    <
probability>50</probability> <!-- defaulted from milestone -->
    <
owner>phillip</owner> <!--  defaulted to authenticated user -->
    <
createdOn>2009-09-30T00:00:00Z</createdOn> <!-- read-only -->
    <
updatedOn>2009-09-30T00:00:00Z</updatedOn> <!-- read-only -->
</
opportunity

Get Opportunity

GET /api/opportunity/{id}

Retrieve a single opportunity by id.

List Opportunities by Party

GET /api/party/{party-id}/opportunity

Retrieve opportunities where the person or organisation is related to the opportunity.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<opportunities size="2">
    <
opportunity>
        ...
    </
opportunity>
    <
opportunity>
        ...
    </
opportunity>
</
opportunities

List Opportunities

GET /api/opportunity?[?start={start}][&limit={limit}]

List opportunities. Optionally the results can be limited or paged using the parameters &limit and &start.

List Opportunities by Milestone

GET /api/opportunity?milestone={milestone-name}[&start={start}][&limit={limit}]

List opportunities at the selected milestone. Optionally the results can be limited or paged using the parameters &limit and &start.

List Opportunities by Tag

GET /api/opportunity?tag={tag-name}[&start={start}][&limit={limit}]

List opportunities by the selected tag. Optionally the results can be limited or paged using the parameters &limit and &start.

List Opportunities Modified Since

GET /api/opportunity?lastmodified={YYYYMMDDTHHMMSS}[&start={start}][&limit={limit}]

Return opportunity records that have been updated or created since the modified since date supplied. The modified since date should be in the format YYYYMMDDTHHMMSS, eg. Midnight June 31, 2009 GMT would be 20090631T000000. Optionally the results can be limited or paged using the parameters &limit and &start.

List Milestones

GET /api/opportunity/milestones

Each account in Capsule can have a unique opportunity milestone configuration. Use the milestone names when creating or updating opportunities.

Example response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<milestones size="4">
    <
milestone>
        <
name>New</name>
        <
description>You have a potential buyer for your offering</description>
        <
probability>10</probability>
        <
complete>false</complete>
    </
milestone>
    <
milestone>
        <
name>Bid</name>
        <
description>You have put forward a bid for your offering</description>
        <
probability>50</probability>
        <
complete>false</complete>
    </
milestone>
    <
milestone>
        <
name>Won</name>
        <
description/>
        <
probability>100</probability>
        <
complete>true</complete>
    </
milestone>
    <
milestone>
        <
name>Lost</name>
        <
description/>
        <
probability>0</probability>
        <
complete>true</complete>
    </
milestone>
</
milestones

List Available Currencies

GET /api/resource/currency

List of ISO currencies currently supported by Capsule. These are the options available when creating new opportunities.

Example response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<currencies>
    <
currency>AUD</currency>
    <
currency>BRL</currency>
    <
currency>CAD</currency>
    <
currency>CHF</currency>
    ...
</
currencies

Add Opportunity

POST /api/party/{party-id}/opportunity

Create a new opportunity attached to this person or organisation, when creating an opportunity for a person attached to an organisation the person is added the additional contact list for this opportunity GET /api/opportunity/{id}/party.

Use the resources GET /api/resource/currency and GET /api/opportunity/milestones to determine the valid options for the <currency /> and <milestone /> elements.

Example request:

<?xml version="1.0"?>
<opportunity>
    <
name>Website design</name>
    <
description>Design and create website</description>
    <
currency>GBP</currency>
    <
value>2000.00</value>
    <
durationBasis>MONTH</durationBasis>
    <
duration>3</duration>
    <
expectedCloseDate>2010-01-15T00:00:00Z</expectedCloseDate>
    <
milestone>Bid</milestone>
    <
owner>jdoe</owner>
</
opportunity

Example response:

HTTP/1.1 201 Created
Location
https://sample.capsulecrm.com/api/opportunity/59 

Update Opportunity

PUT /api/opportunity/{id}
or PUT /api/party/{party-id}/opportunity/{id}

Update the opportunity, if moving the opportunity to another person or organisation use the alternative party version of the URL. When updating an opportunity for a person attached to an organisation the person is added the additional contact list for this opportunity GET /api/opportunity/{id}/party.

Use the resources GET /api/resource/currency and GET /api/opportunity/milestones to determine the valid options for the <currency /> and <milestone /> elements.

Example request:

<?xml version="1.0"?>
<opportunity>
    <
milestone>Won</milestone>
</
opportunity

Delete Opportinity

DELETE /api/opportunity/{id}

 

 

Capsule is a service of Zestia Ltd which is a company registered in England with company number 06418281. © 2008-2012 Zestia Ltd. All Rights Reserved.