Using Solution Central APIs > Add Solution Files
Add Solution Files
Once a solution is developed, you need to upload its ZIP, as well as an MD5 checksum that ThingWorx uses to verify its integrity before you publish it. The following sections provide information on how to prepare the files and send them to Solution Central.
Prepare the Files
1. Create solution ZIP
Your solution must be a ZIP file containing XML entities, as mentioned in Solution Identifiers. For the purpose of understanding the process, we will name the solution solution.zip. It can have any other filename.
2. Compute MD5 on solution ZIP
Compute an MD5 checksum on solution.zip. You can use a utility such as DigestUtils (Apache Commons Codec 1.15 API) on the contents of the zip. This checksum is only required for Solution Central to accept the upload; ThingWorx does not use it.
3. Compute SHA hash and save it
On the solution.zip, run a secure SHA_256 hash, so that ThingWorx can validate its authenticity. For instance, org.apache.commons.codec.digest.DigestUtils.sha256Hex(zipFileBytes). You can use a utility such as DigestUtils (Apache Commons Codec 1.15 API). Store the resulting secure hash as text in a file. We will name this file solution.sha. It can have any other filename.
4. Compute MD5 on hash file
Compute an MD5 checksum on solution.sha. You can use a utility such as DigestUtils (Apache Commons Codec 1.15 API) on the contents of the zip. This checksum is only required for Solution Central to accept the upload; ThingWorx does not use it.
Send Files to Solution Central
You need to make two PUT requests to Solution Central—one for the ZIP and one for its hash. Both PUT requests require the following additional headers:
x-sc-primary-file
For the ZIP, this header must be true.
For the hash file, this header can be omitted or set to false.
Content-MD5
The MD5 checksum which can be computed by a utility such as DigestUtils (Apache Commons Codec 1.15 API). It must be a 32-digit hex number.
x-sc-filename
The destination filename in storage. You may choose a different filename; however, the extensions must be as mentioned—the filename for the ZIP must end in .zip while that for the hash must end in .sha.
Both files must have the same root (name-version.zip and name-version.sha)
For instance:
ZIP Filename
Hash Filename
Whether OK?
solution.zip
solution.sha
OK
mysolution-1.3.0.zip
mysolution-1.3.0.sha
OK
solution.zip
solution-1.0.0.sha
Not OK
literallyanything.zip
literallyanything.sha
OK
literallyanything.zip
anythingelse.sha
Not OK
Example cUrl Requests
curl.exe -L -d @"sample.zip" -H "Accept:application/json" -H "Content-MD5:afb63346a445161955e9cd883aac246b" -H "x-sc-primary-file:true" -H "x-sc-filename:solution.zip" -X PUT "<your solution central URL>/files"
curl.exe -L -d @"sample.sha" -H "Accept:application/json" -H "Content-MD5:78cae945f5d392cb37c400467fe794ec" -H "x-sc-filename:solution.sha" -X PUT "<your solution central URL>/files"
Once the files are ready in the format specified above, use the Add Solution File API to upload these files.
* 
The Solution Central APIs can be accessed using your Solution Central application. In Solution Central, click Help > Public APIs from the left-hand navigation menu to see the available Solution Central APIs.
Was this helpful?