InvoicesGetInvoiceSpecificationPDF

GetInvoiceSpecificationPDF

Invoicing service 1.1: Generates and returns, as base64 PDF bytes, the specification pages of an invoice, credit note, voucher or reminder by its integer ID.

ServiceInvoicing 1.1
EndpointPOST https://app{server-number}.timelog.com/{account}/WebServices/Invoicing/V1_1/InvoicingServiceSecure.svc
SOAPActionGetInvoiceSpecificationPDFRequest
Content-Typetext/xml; charset=utf-8
AuthenticationA token from GetToken
Changes dataNo
Safe to retryYes

How it works

It does not return the invoice page itself. Despite the name, invoiceID can be the ID of ANY invoicing document: invoice, credit note, voucher or reminder. The specification template is the one linked to the document's own print template; the document is rendered as it is now. The PDF is generated on every call and the whole document is buffered into the response - there is no streaming or MTOM. Large specifications therefore produce large SOAP messages; raise your client's maximum received message size accordingly. An unknown ID returns a misleading null-reference error.

Parameters

Each parameter has one label: Required, Conditional (required depending on other values) or Optional. Send them in the order shown.

invoiceIDinteger
Required

Integer ID of the invoicing document - not a GUID.

tokenSecurityToken
Required

The token from GetToken: Initials, Expires and Hash, sent back unchanged.

Request

POST /{account}/WebServices/Invoicing/V1_1/InvoicingServiceSecure.svc HTTP/1.1
Host: app{server-number}.timelog.com
Content-Type: text/xml; charset=utf-8
SOAPAction: "GetInvoiceSpecificationPDFRequest"

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:invoicing="http://www.timelog.com/api/tlp/v1"
                  xmlns:tok="http://www.timelog.com/api/tlp/v1_3">
  <soapenv:Body>
    <invoicing:GetInvoiceSpecificationPDF>
      <invoicing:invoiceID>{invoiceID}</invoicing:invoiceID>
      <invoicing:token>
        <tok:Initials>{Initials from GetToken}</tok:Initials>
        <tok:Expires>{Expires from GetToken, unchanged}</tok:Expires>
        <tok:Hash>{Hash from GetToken}</tok:Hash>
      </invoicing:token>
    </invoicing:GetInvoiceSpecificationPDF>
  </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.

ReturnInvoiceSpecification[]

Response<InvoiceSpecification>: Return[0].specification = the PDF bytes. No 'Successfully called' message. Never empty on success.

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>
    <GetInvoiceSpecificationPDFResponse xmlns="http://www.timelog.com/api/tlp/v1">
      <GetInvoiceSpecificationPDFResult xmlns:a="http://api.timelog.com"
                                        xmlns:b="http://www.timelog.com/api/tlp/v1"
                                        xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <a:Return>
          <b:InvoiceSpecification>
            <a:Action>Original</a:Action>
            <a:IsCustomFieldsLoaded>false</a:IsCustomFieldsLoaded>
            <a:CustomFields i:nil="true"/>
            <a:IsExternalKeysLoaded>false</a:IsExternalKeysLoaded>
            <a:ExternalKeys i:nil="true"/>
            <b:specification>AAAAAAAAAAA=</b:specification>
          </b:InvoiceSpecification>
        </a:Return>
        <a:ReturnTypeDescription>InvoiceSpecification</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>
      </GetInvoiceSpecificationPDFResult>
    </GetInvoiceSpecificationPDFResponse>
  </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 'Object reference not set to an instance of an object.'No invoicing document has this ID.Check the invoice ID.