Administrate

Opportunity Steps

Note

The Opportunity Steps endpoint is part of Version 2.5 (v2.5) of the REST API.

Fields

Attributes:

  • closed
  • current
  • id
  • name
  • probability
  • time_in_step
  • time_to_win
  • time_to_win_days
  • value

Relations:

  • attributes - OpportunityAttribute
  • stage - OpportunityStage
  • transitions - OpportunityTransition

Getting Opportunity Steps

GET /api/v2.5/crm/opportunity_steps/:id
statuscode 200:no error
statuscode 404:does not exist
Using Python:
import json
import requests

response = requests.get('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/8',
                auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/8 \ 
    -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/8';

$options = array(
  'http' => array(
    'method'  => 'GET',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
{
    "current": null,
    "name": "Proposal",
    "probability": null,
    "time_to_win": null,
    "value": null,
    "time_in_step": null,
    "time_to_win_days": null,
    "closed": null,
    "attributes": [],
    "transitions": [],
    "id": 8,
    "stage": {
        "status": "Open",
        "id": 2,
        "name": "Open"
    }
}

Getting more than one Opportunity Step

GET /api/v2.5/crm/opportunity_steps
statuscode 200:no error
Using Python:
import json
import requests

response = requests.get('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps',
                auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps \ 
    -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps';

$options = array(
  'http' => array(
    'method'  => 'GET',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
[
    {
        "current": null,
        "name": "Demo",
        "probability": null,
        "time_to_win": null,
        "value": null,
        "time_in_step": null,
        "time_to_win_days": null,
        "closed": null,
        "attributes": [],
        "transitions": [],
        "id": 2,
        "stage": {
            "status": "Open",
            "id": 2,
            "name": "Open"
        }
    },
    {
        "current": null,
        "name": "Proposal",
        "probability": null,
        "time_to_win": null,
        "value": null,
        "time_in_step": null,
        "time_to_win_days": null,
        "closed": null,
        "attributes": [],
        "transitions": [],
        "id": 3,
        "stage": {
            "status": "Open",
            "id": 2,
            "name": "Open"
        }
    },
    {
        "current": null,
        "name": "Won",
        "probability": null,
        "time_to_win": null,
        "value": null,
        "time_in_step": null,
        "time_to_win_days": null,
        "closed": null,
        "attributes": [],
        "transitions": [],
        "id": 4,
        "stage": {
            "status": "Won",
            "id": 3,
            "name": "Won"
        }
    },
    {
        "current": null,
        "name": "Enquiry",
        "probability": null,
        "time_to_win": null,
        "value": null,
        "time_in_step": null,
        "time_to_win_days": null,
        "closed": null,
        "attributes": [],
        "transitions": [],
        "id": 5,
        "stage": {
            "status": "Open",
            "id": 1,
            "name": "New"
        }
    }
]

Filtering

The results for a list of Opportunity Steps can be filtered. See Version 2.5 (v2.5) for more details.

Creating an Opportunity Step

POST /api/v2.5/crm/opportunity_steps
statuscode 200:no error
statuscode 400:bad request
Using Python:
import json
import requests

data = {'name': 'New Opportunity Step', 'stage': {'id': 7L}}

response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps',
                data=json.dumps(data),
                headers={'content-type': 'application/json'},
                auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps \ 
    -H "Content-Type: application/json" \
    -d '{
    "name": "New Opportunity Step", 
    "stage": {
      "id": 7
    }
  }' \ 
    -X POST \ 
    -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps';

$data = array("name" => "New Opportunity Step",
  "stage" => array("id" => 7));
$options = array(
  'http' => array(
  'method'  => 'POST',
  'content' => json_encode($data),
  'header'=>  "Content-Type: application/json\r\n" .
        "Accept: application/json\r\n" .
        "Authorization: Basic " . base64_encode($credentials)
  )
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
{
    "current": null,
    "name": "New Opportunity Step",
    "probability": null,
    "time_to_win": null,
    "value": null,
    "time_in_step": null,
    "time_to_win_days": null,
    "closed": null,
    "attributes": [],
    "transitions": [],
    "id": 10,
    "stage": {
        "status": "Open",
        "id": 7,
        "name": "New"
    }
}

Updating an Opportunity Step

PUT /api/v2.5/crm/opportunity_steps/:id
statuscode 200:no error
statuscode 400:bad request
Using Python:
import json
import requests

data = {'name': 'Some new step name'}

response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/7',
                data=json.dumps(data),
                headers={'content-type': 'application/json'},
                auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/7 \ 
    -H "Content-Type: application/json" \
    -d '{
    "name": "Some new step name"
  }' \ 
    -X PUT \ 
    -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/7';

$data = array("name" => "Some new step name");
$options = array(
  'http' => array(
  'method'  => 'PUT',
  'content' => json_encode($data),
  'header'=>  "Content-Type: application/json\r\n" .
        "Accept: application/json\r\n" .
        "Authorization: Basic " . base64_encode($credentials)
  )
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
{
    "current": null,
    "name": "Some new step name",
    "probability": null,
    "time_to_win": null,
    "value": null,
    "time_in_step": null,
    "time_to_win_days": null,
    "closed": null,
    "attributes": [],
    "transitions": [],
    "id": 7,
    "stage": {
        "status": "Open",
        "id": 2,
        "name": "Open"
    }
}

Deleting an Opportunity Step

DELETE /api/v2.5/crm/opportunity_steps/:id
statuscode 200:no error
Using Python:
import json
import requests

response = requests.delete('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/1',
                auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/1 \ 
    -X DELETE \ 
    -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2.5/crm/opportunity_steps/1';

$options = array(
  'http' => array(
    'method'  => 'DELETE',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
{
    "current": null,
    "name": "Enquiry",
    "probability": null,
    "time_to_win": null,
    "value": null,
    "time_in_step": null,
    "time_to_win_days": null,
    "closed": null,
    "attributes": [],
    "transitions": [],
    "id": 1,
    "stage": {
        "status": "Open",
        "id": 1,
        "name": "New"
    }
}