Skip to content

HPInc/printos-composer-api-samples

Repository files navigation

Wolcome to Composer Service SDK V1 Client Sample code

The sample code demonstrate how to produce VDP samples and full PDF VDP processing. The client communicate with the Composer Server doing the VDP processing. When done, client receive a URL it can download the output PDFs from.

The sample code is supplied in Java using Resteasy client, though any client technology can be used - the calls are simple HTTP calls.

For your convinent, while running, the code printout to standard output all REST calls, including request\resonse json payloads.

Configuration File

apiBaseUrl - base URL for the APIs - hard coded

xHpHmacAuthentication - Hmac auth header name - hard coded xHpHmacDate - Hmac date header name - hard coded xHpHmacAlgorithm - Hmac Algorithm header name - hard coded

hmacAlgorithm - SHA256 - hard coded.

Compiling and running the Sample

This project is a maven java project. From the sample project root directory run: mvn install

The compilation result will go to target directory

IDE

Make sure the command line and working directory is defined properly.

Running

To run the sample use the following command line from the target folder:

java -jar composer-sdk-sample-code-1.0.jar < hmacKey > < hmacSecret > [ useProxy ] [ proxyHost ] [ roxyPort ]

hmacKey - hmac key generated by PrintOS hmacSecret - hmac secret generated by PrintOS useProxy - not must. can get "true" or "false". if not suppled assume false. proxyHost - if useProxy is true, then this value is a must - should contain the proxy host name proxyPort - if useProxy is true, then this value is a must - should contain the proxy port number

For example: target>java -jar composer-sdk-sample-code-1.0.jar ui4h5o2uih45ouh2o3u45h3ouih45o3u 23j4i234h5io2u34h5o23u5ho3u4h5o2 true my.proxy.com 8080

Folders Structure

sample-files Sample Input Files: VDP Templates (hpd), imposition template (impp), data files (txt, csv)

src\main\java\com\hp\composer\sdk\api\v1\SampleCodeRunner.java - main class executing the examples in this sample code.

target build target folder

src\main\java\com\hp\composer\sdk\api\v1\assetUploader Demonstrate how to upload files using the SDK.

src\main\java\com\hp\composer\sdk\api\v1\configuration\Configuration.java Configuration file - see configuration file below

src\main\java\com\hp\composer\sdk\api\v1\examples Data structure being used for sample definition

src\main\java\com\hp\composer\sdk\api\v1\helpers Helper classes: http client, printout, HMAC

src\main\java\com\hp\composer\sdk\api\v1\resources The SDK API Data structures - request and response payloads.

About

collection of code samples to assist with developing integrations to the HP PrintOS Composer API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages