Upload Package
The Upload Package method uploads a HotDocs Template Package File (.hdpkg) to Cloud Services. The HotDocs Template Package File is created using HotDocs Developer. It contains files required to display an interview and assemble a document. A HotDocs Package File must be uploaded to the Service before it can be used in other Service methods, i.e. GetInterview, Assemble Document, GetComponentInfo, GetInterviewFile.
Upload Package PUT
HTTP Request
PUT https://{subscribedEndpoint}/hdcs/{subscriberID}/{packageID}
Parameters
Name | Location | Required | Description |
subscribedEndpoint | Path |
Yes |
The endpoint to which the caller is subscribed. This is either:
|
subscriberID | Path |
Yes |
The caller's Cloud Services subscriber ID |
packageID | Path | Yes | A package ID that will be used to identify this template package in future requests. A GUID is strongly recommended; it must at least be unique for all packages uploaded and used by this subscriber. |
packageContent | Request body | Yes | The template package itself is supplied in the request body. This content will be cached for some period of time by Cloud Services; consequently packages are typically assumed to be cached and are referred to using the packageID (without needing to upload them repeatedly). |
date | HTTP header or query string | Yes | The date and time (in UTC) of the request, formatted according to RFC 1123. This date can be included either as a parameter on the query string or in an "x-hd-date" (custom) HTTP header. |
signature | HTTP header | Yes | The base64-encoded HMAC calculated using the parameters of this request. Note: the HMAC must be included in an "Authorization" HTTP header. See HMAC calculation for Upload Package for more information. |
billingRef | Query string | No | Enables you to specify information to include in usage logs for this call. For example, you can use a string to uniquely identify the end user that initiated the request and/or the context in which they made the call. When you later review usage logs, you can see which end users initiated each request. This information can enable you to audit or pass costs on to those end users. |
Example URL
https://cloud.hotdocs.ws/hdcs/examplesubscriber/ed40775b-5e7d-4a51-b4d1-32bf9d6e9e29
Response
If successful, this method returns a 201 Created status code.
Request Headers
When making an Upload request to Cloud Services, the request must include the following headers.
Name |
Type |
Example Data |
Description |
Example (C#) |
x-hd-date |
DateTime value |
2015-01-31T08:55:19Z |
The Date and Time of the request. This is the same value as the date/time used when calculating the HMAC. |
request.Headers.Add("x-hd-date", timestamp.ToString("yyyy-MM-ddTHH:mm:ssZ")); |
Content-Type |
String |
application/binary |
The type of content being sent with the request. For uploading, the content is the Template Package File. |
request.Content.Headers.Add("Content-Type", "application/binary"); |
Authorization |
String |
Calculated HMAC |
The HMAC used to sign the request. |
request.Headers.TryAddWithoutValidation("Authorization", hmac); |
Example Request
PUT https://cloud.hotdocs.ws/hdcs/examplesubscriber/ed40775b-5e7d-4a51-b4d1-32bf9d6e9e29 HTTP/1.1 Content-Disposition: form-data; name="files"; filename="ExampleTemplatePackage.hdpkg" x-hd-date: 2015-07-13T10:02:16Z Content-Type: application/binary Host: cloud.hotdocs.ws Content-Length: 16296 Expect: 100-continue Connection: Keep-Alive
HMAC Calculation for Upload Package
For calls to Upload Package, the HMAC is calculated from the following list of parameters:
Name |
Type |
Example Data |
Description |
signingKey |
String |
example-signing-key |
The Signing Key assigned to your Cloud Services account. You can find your Signing Key by logging in to the Cloud Services Portal. |
date |
DateTime |
2015-01-31T08:55:19Z |
Date and time of the request, using the format "yyyy-MM-ddTHH:mm:ssZ". For example, a datetime of 31/05/2015 08:55:19 is formatted as 2015-01-31T08:55:19Z. |
subscriberID |
String |
ExampleCompany |
Subscriber ID named used to connect to Cloud Services. This was provided when you signed up to Cloud Services. |
packageID |
String |
ed40775b-5e7d-4a51-b4d1-32bf9d6e9e29 |
The name of the HotDocs Package File (.hdpkg) uploaded to Cloud Services. |
templateName |
String |
null |
A null value. As you are not interacting with a template inside the package file, this must be null. |
sendPackage |
Boolean |
True |
A boolean value. For uploading a template to Cloud Services, this is always True, as a package file is being sent with the request. |
billingRef |
String |
ExampleCustomer, Template Upload |
Enables you to specify information to include in usage logs for this call. For example, you can use a string to uniquely identify the end user that initiated the request and/or the context in which they made the call. When you later review usage logs, you can see which end users initiated each request. This information can enable you to audit or pass costs on to those end users. |
Example (C#)
Walkthrough
For a full walkthrough of calculating the HMAC and uploading a template to Cloud Services, see the Cloud Services Example 1: Uploading a Template article in the HotDocs Integrations documentation.
Code
For a full code example of uploading a template package file to Cloud Services, see the CloudServicesAPIExample1Upload project in the HotDocs Integration Examples.