Prices and ratesCreateCustomerPriceList

CreateCustomerPriceList

Financial service 1.4: Gives a customer its own copies of selected standard price groups of a legal entity.

ServiceFinancial 1.4
EndpointPOST https://app{server-number}.timelog.com/{account}/WebServices/Financial/V1_4/FinancialServiceSecure.svc
SOAPActionhttp://www.timelog.com/api/tlp/v1_4/FinancialService/CreateCustomerPriceList
Content-Typetext/xml; charset=utf-8
AuthenticationA token from GetToken
Changes dataYes
Safe to retryYes

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.

legalEntityIdinteger
Required

Not the GUID GetPriceGroups takes.

customerIdinteger
Required

Integer ID of the customer.

priceGroupIdsinteger[]
Required

IDs of STANDARD price groups of that legal entity. At least one; non-matching IDs are ignored.

tokenSecurityToken
Required

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>
Replace every {…} placeholder with your own value.

Response

The call returns the standard response envelope. Check ResponseState first: a failed call still returns HTTP 200.

ResponseStatestring
Required

Success, Invalid or Error.

ErrorCodeinteger

0 on success, otherwise the error code. See Errors.

ReturnCustomerPriceList[]

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>
Illustrative example: built from the service description (WSDL) in the same format as a real response, with made-up values. The 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:

ResponseStateErrorCodeMessageWhat it meansWhat to do
Error40001Error 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.
Error40001Error during call on TimeLog.API, Message 'Value cannot be null.
Parameter name: customerID'customerId 0 or unknown.Send an existing customer ID.