Generating and Viewing Docs

The USolver document is a JSON file that can be easily created and used. Additionally, you can run it directly on https://usolver.com without requiring additional setup. To do this, generate your JSON file and submit it via an HTTP form to the endpoint: "https://usolver.com/create/preview.html#file/post." Below are examples of such forms:

<form action="https://usolver.com/create/preview.html#file/post" method="post"> <!-- encoding can be either json or base64 --> <input type="text" name="encoding" value="json" size="8"> <input type="text" name="root" value="https://mydomain.com/samples/ext-linking" size="50"> <textarea name="usolver-file" style="width: 100%; height: 100px">-- usolver file in JSON format --</textarea> <br><br> <input type="submit" value="Sumbit Base64 encoded" style="font-size: 20px; padding: 5px 15px;"> </form>

Explanation

The form's method can be either a POST or a GET. If it is a POST, the endpoint should end with "...#/file/post", and if it is a GET, it should end with "...#/file/get". The form requires only one field, which is "usolver-file". This field is a text input containing the entire document in plain JSON format.

There are two additional optional fields: "encoding" and "root". The "encoding" field can have a value of either "json" or "base64". If set to "json", the file should be plain JSON text. If set to "base64", the file should be a Base64-encoded JSON string.

The "root" parameter is optional and specifies a base folder for all attached images and scripts unless those scripts are inlined.

Parameter Req. Description Possible Values
usolver-file Yes Contains the entire document in plain JSON format. Plain JSON text
encoding No Specifies the file encoding. json, base64
root No Specifies a base folder for all attached images and scripts unless inlined. https://mydomain.com/folder

If file is encoded with base64 and if it has multibyte characters (such as chineese in UTF-8 for example), it needs to be encoded with the following JS function

function base64encode(str) { let utf8Bytes = new TextEncoder().encode(str) let binaryString = '' for (let byte of utf8Bytes) { binaryString += String.fromCharCode(byte) } return btoa(binaryString) }

Loading Remote Files

You can also load USolver files from a remote location. To do so, you need to open preview and pass url where to load file from. For example:

Open Sample
https://usolver.com/create/preview.html#/file/"https://usolver.com/api/fs/download/fCMVXvv"

where file path can be either absolute or relative to the current domain

Passing Entire File in URL

You can pass base64 encoded USolver file in the URL:

Open Sample
https://usolver.com/create/preview.html#file/base64:eyJpbmZvIjp7InVzZXJpZCI6MSwibmFtZSI6InNhbXBsZS1zaW1wbGUiLCJjcmVhdGVUaW1lIjoxNzQyNTk4MDM5Mjk1LCJ1cGRhdGVUaW1lIjoxNzQyNTk4MDM5Mjk1LCJmb2xkZXIiOm51bGx9LCJ1ZG9jIjp7ImRhdGEiOlt7Im5hbWUiOiJzaGVldDEifV0sInNsaWRlcyI6W3siaWQiOiJzbGlkZTEiLCJlbGVtZW50cyI6W3sibmFtZSI6IlRYVDEiLCJsZWZ0IjoxMTUuOTMsInRvcCI6MTE3LjE0LCJ3aWR0aCI6MjI2LCJoZWlnaHQiOjEzMSwidGV4dCI6IjxzcGFuIHN0eWxlPVwiZm9udC1zaXplOiAxOC4wcHg7IGZvbnQtZmFtaWx5OiBpbmhlcml0OyBmb250LXdlaWdodDogaW5oZXJpdFwiPlNhbXBsZSBGaWxlPC9zcGFuPiIsImJhY2tncm91bmQiOnsidHlwZSI6InNvbGlkIiwiY29sb3IiOiIjRkFGQUZBIn0sImlkIjoibGFiZWwtMCIsInR5cGUiOiJsYWJlbCJ9XX1dLCJlbnYiOnsibXVsdGlzaGVldCI6dHJ1ZSwibGFzdElkIjoxfSwidmVyc2lvbiI6My44OX0sImF0dGFjaG1lbnRzIjpbXX0=