GetOpportunityTypesShortlist
Reporting API: Returns the account's opportunity types.
| API | Reporting API (short lists) |
| Endpoint | POST https://app{server-number}.timelog.com/{account}/Service.asmx |
| SOAPAction | http://www.timelog.com/ws/tlp/v4_4/GetOpportunityTypesShortlist |
| Content-Type | text/xml; charset=utf-8 |
| Authentication | siteCode, apiID and apiPassword as the first three parameters. See Authentication |
| Changes data | No. Safe to retry. |
| Paging | No: the whole result comes in one response. Narrow it with the filters. |
How it works
Filter: active status. Valid values for GetOpportunitiesRaw's opportunityTypeID filter. The XSD lacks the GUID element.
Parameters
Each parameter has one label: Required, Conditional (required depending on other values) or Optional. Send them in the order shown.
Your account's site code, from the Reporting API settings.
The Reporting API ID, from the Reporting API settings.
The Reporting API password, from the Reporting API settings.
Use -1 for no filter. Active flag.
Request
POST /{account}/Service.asmx HTTP/1.1
Host: app{server-number}.timelog.com
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.timelog.com/ws/tlp/v4_4/GetOpportunityTypesShortlist"
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tlp="http://www.timelog.com/ws/tlp/v4_4">
<soap:Body>
<tlp:GetOpportunityTypesShortlist>
<tlp:siteCode>{siteCode}</tlp:siteCode>
<tlp:apiID>{apiID}</tlp:apiID>
<tlp:apiPassword>{apiPassword}</tlp:apiPassword>
<tlp:status>-1</tlp:status>
</tlp:GetOpportunityTypesShortlist>
</soap:Body>
</soap:Envelope>
curl -X POST "https://app{server-number}.timelog.com/{account}/Service.asmx" \
-H "Content-Type: text/xml; charset=utf-8" \
-H 'SOAPAction: "http://www.timelog.com/ws/tlp/v4_4/GetOpportunityTypesShortlist"' \
--data-binary @request.xml
import requests
URL = "https://app{server-number}.timelog.com/{account}/Service.asmx"
SOAP_ACTION = '"http://www.timelog.com/ws/tlp/v4_4/GetOpportunityTypesShortlist"'
envelope = """<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tlp="http://www.timelog.com/ws/tlp/v4_4">
<soap:Body>
<tlp:GetOpportunityTypesShortlist>
<tlp:siteCode>{siteCode}</tlp:siteCode>
<tlp:apiID>{apiID}</tlp:apiID>
<tlp:apiPassword>{apiPassword}</tlp:apiPassword>
<tlp:status>-1</tlp:status>
</tlp:GetOpportunityTypesShortlist>
</soap:Body>
</soap:Envelope>"""
response = requests.post(
URL,
data=envelope.encode("utf-8"),
headers={"Content-Type": "text/xml; charset=utf-8", "SOAPAction": SOAP_ACTION},
timeout=300,
)
rows = parse_result(response) # see "Responses and errors"
{…} placeholder with your own value.Response
The result is an XML document inside GetOpportunityTypesShortlistResult: a tlp:OpportunityTypes root with one tlp:OpportunityType element per record. Check the response format first: the same slot also carries the empty result and errors.
Order: Opportunity type ID ascending.
One element per record. Fields without a value are left out of the element, so treat every field as optional.
Example response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetOpportunityTypesShortlistResponse xmlns="http://www.timelog.com/ws/tlp/v4_4">
<GetOpportunityTypesShortlistResult>
<tlp:OpportunityTypes xmlns:tlp="http://www.timelog.com/XML/Schema/tlp/v4_4">
<tlp:OpportunityType ID="1001">
<tlp:GUID>3F2504E0-4F89-41D3-9A0C-0305E82C3314</tlp:GUID>
<tlp:Name>Example </tlp:Name>
<tlp:IsActive>0</tlp:IsActive>
</tlp:OpportunityType>
</tlp:OpportunityTypes>
</GetOpportunityTypesShortlistResult>
</GetOpportunityTypesShortlistResponse>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetOpportunityTypesShortlistResponse xmlns="http://www.timelog.com/ws/tlp/v4_4">
<GetOpportunityTypesShortlistResult>
<tlp:OpportunityTypes resultEmpty="true" xmlns:tlp="http://www.timelog.com/XML/Schema/tlp/v4_4"></tlp:OpportunityTypes>
</GetOpportunityTypesShortlistResult>
</GetOpportunityTypesShortlistResponse>
</soap:Body>
</soap:Envelope>
Example error
Wrong credentials, or a call over plain HTTP:
HTTP/1.1 401 Unauthorized
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetOpportunityTypesShortlistResponse xmlns="http://www.timelog.com/ws/tlp/v4_4">
<GetOpportunityTypesShortlistResult>
<tlp:Errors xmlns:tlp="http://www.timelog.com/XML/Schema/tlp/v4_4">
<tlp:Error>Access denied. Check siteCode, apiID, apiPassword and SSL settings</tlp:Error>
</tlp:Errors>
</GetOpportunityTypesShortlistResult>
</GetOpportunityTypesShortlistResponse>
</soap:Body>
</soap:Envelope>
Errors
The errors every method can return (access denied, operation failed, invalid request) are listed once in Responses and errors.
This method has no errors of its own beyond the shared ones.