CreateCustomerPriceList
Financial service 1.4: Gives a customer its own copies of selected standard price groups of a legal entity.
| Service | Financial 1.4 |
| Endpoint | POST https://app{server-number}.timelog.com/{account}/WebServices/Financial/V1_4/FinancialServiceSecure.svc |
| SOAPAction | http://www.timelog.com/api/tlp/v1_4/FinancialService/CreateCustomerPriceList |
| Content-Type | text/xml; charset=utf-8 |
| Authentication | A token from GetToken |
| Changes data | Yes |
| Safe to retry | Yes |
How it works
For the legal entity legalEntityId and the customer customerId, the server takes the requested priceGroupIds that are STANDARD price groups of that legal entity and, for each one, creates a customer-specific price group with the same name and currency if the customer has none with that ID or name, or re-activates the customer's same-named price group if it exists but is inactive - and with it the customer's previously deactivated hourly rates in that group. IDs that are not standard groups of the legal entity are SILENTLY IGNORED; if none match, nothing is created and the call still succeeds. The response does not describe what was created: Return[0] carries the legal entity's name, integer ID and active flag, with IsSystem false. Use GetPriceGroups or the hourly-rate operations to see the result.
Parameters
Each parameter has one label: Required, Conditional (required depending on other values) or Optional. Send them in the order shown.
Not the GUID GetPriceGroups takes.
Integer ID of the customer.
IDs of STANDARD price groups of that legal entity. At least one; non-matching IDs are ignored.
The token from GetToken: Initials, Expires and Hash, sent back unchanged.
Request
POST /{account}/WebServices/Financial/V1_4/FinancialServiceSecure.svc HTTP/1.1
Host: app{server-number}.timelog.com
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.timelog.com/api/tlp/v1_4/FinancialService/CreateCustomerPriceList"
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:financial="http://www.timelog.com/api/tlp/v1_4"
xmlns:tok="http://www.timelog.com/api/tlp/v1_3"
xmlns:arrays="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soapenv:Body>
<financial:CreateCustomerPriceList>
<financial:legalEntityId>{legalEntityId}</financial:legalEntityId>
<financial:customerId>{customerId}</financial:customerId>
<financial:priceGroupIds>
<arrays:int>{int}</arrays:int>
</financial:priceGroupIds>
<financial:token>
<tok:Initials>{Initials from GetToken}</tok:Initials>
<tok:Expires>{Expires from GetToken, unchanged}</tok:Expires>
<tok:Hash>{Hash from GetToken}</tok:Hash>
</financial:token>
</financial:CreateCustomerPriceList>
</soapenv:Body>
</soapenv:Envelope>
curl -X POST "https://app{server-number}.timelog.com/{account}/WebServices/Financial/V1_4/FinancialServiceSecure.svc" \
-H "Content-Type: text/xml; charset=utf-8" \
-H 'SOAPAction: "http://www.timelog.com/api/tlp/v1_4/FinancialService/CreateCustomerPriceList"' \
--data-binary @request.xml
import requests
URL = "https://app{server-number}.timelog.com/{account}/WebServices/Financial/V1_4/FinancialServiceSecure.svc"
SOAP_ACTION = '"http://www.timelog.com/api/tlp/v1_4/FinancialService/CreateCustomerPriceList"'
envelope = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:financial="http://www.timelog.com/api/tlp/v1_4"
xmlns:tok="http://www.timelog.com/api/tlp/v1_3"
xmlns:arrays="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soapenv:Body>
<financial:CreateCustomerPriceList>
<financial:legalEntityId>{legalEntityId}</financial:legalEntityId>
<financial:customerId>{customerId}</financial:customerId>
<financial:priceGroupIds>
<arrays:int>{int}</arrays:int>
</financial:priceGroupIds>
<financial:token>
<tok:Initials>{Initials from GetToken}</tok:Initials>
<tok:Expires>{Expires from GetToken, unchanged}</tok:Expires>
<tok:Hash>{Hash from GetToken}</tok:Hash>
</financial:token>
</financial:CreateCustomerPriceList>
</soapenv:Body>
</soapenv:Envelope>"""
response = requests.post(
URL,
data=envelope.encode("utf-8"),
headers={"Content-Type": "text/xml; charset=utf-8", "SOAPAction": SOAP_ACTION},
timeout=60,
)
result = parse_result(response) # see "Responses and errors"
{…} placeholder with your own value.Response
The call returns the standard response envelope. Check ResponseState first: a failed call still returns HTTP 200.
Success, Invalid or Error.
0 on success, otherwise the error code. See Errors.
Response<CustomerPriceList>: Return[0] = legal entity name / ID / active flag, IsSystem false - identical whether or not anything was created. No success message is added.
Example response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<CreateCustomerPriceListResponse xmlns="http://www.timelog.com/api/tlp/v1_4">
<CreateCustomerPriceListResult xmlns:a="http://api.timelog.com"
xmlns:b="http://schemas.datacontract.org/2004/07/TimeLog.TLP.API.Proxy.Financial.V1_4"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:Return>
<b:CustomerPriceList>
<b:IsActive>true</b:IsActive>
<b:IsSystem>false</b:IsSystem>
<b:Name>Example </b:Name>
<b:PriceListID>1001</b:PriceListID>
</b:CustomerPriceList>
</a:Return>
<a:ReturnTypeDescription>CustomerPriceList</a:ReturnTypeDescription>
<a:Request>…</a:Request>
<a:ResponseState>Success</a:ResponseState>
<a:Messages>
<a:APIMessage>
<a:Message>Duration of call was 0,0421337 sec.</a:Message>
<a:Severity>Message</a:Severity>
<a:ErrorCode>0</a:ErrorCode>
</a:APIMessage>
</a:Messages>
<a:ErrorCode>0</a:ErrorCode>
<a:IsReturnPaged>false</a:IsReturnPaged>
<a:TotalPageCount>0</a:TotalPageCount>
</CreateCustomerPriceListResult>
</CreateCustomerPriceListResponse>
</s:Body>
</s:Envelope>
Request block is shortened.Errors
All errors come back with HTTP 200: check ResponseState, ErrorCode and Messages. The errors every operation can return (expired or invalid token, API not enabled, HTTPS required, general errors) are listed once in Responses and errors.
Errors specific to this operation:
| ResponseState | ErrorCode | Message | What it means | What to do |
|---|---|---|---|---|
| Error | 40001 | Error during call on TimeLog.API, Message 'At least one price group needs to be use for create customer price list' | priceGroupIds empty. | Send at least one standard price group ID of the legal entity. |
| Error | 40001 | Error during call on TimeLog.API, Message 'Value cannot be null. | ||
| Parameter name: customerID' | customerId 0 or unknown. | Send an existing customer ID. |