Northstar Essentials (Create 14/Ruby) API Guide
This documentation describes the Application Programming Interfaces (API v2) for Northstar Essentials version R2025 (formerly Create 14/Ruby) and later.
Introducing Northstar Essentials API 2
Using this API, software programmers are able to produce documents in high volumes and manage customer communications, according to the different MHC Create layers.
The following features are matching the MHC Create solution:
- Render documents dynamically, in real-time, using XML or JSON as input data to output formats such as PDF, HTML, Text.
- Data Integration (SQL, XML, JSON, CSV, etc.).
- Document Assembly Line (with additional inputs such as Word, Excel, PDF, TIFF, JPEG, SVG, Barcodes, Charts, 3-D Objects).
- Use document templates created in MHC Studio to control layout, styles, colors and other visual aspects.
Northstar Essentials provides the following APIs:
C#for .NET programmers by adding a reference to theCreate.Client.NET.dllassemblyJavafor Java programmers through theCreate.Client.JAVA-2.0.0.jarpackage
The communication between these APIs and the MHC Create server is performed through REST endpoints via HTTP or HTTPS.
Notes
50100 (HTTP) and 50101 (HTTPS). HTTPS (port 443) access is provided.Live REST API Documentation
The REST API is accompanied by a live documentation page which allows you to send requests in real time and examine the response.
The Live REST API Inspector can be accessed via a web page under the /swagger URL. For a local installation using the default ports, this would be:
- For HTTP: http://localhost:50100/swagger
- For HTTPS: https://localhost:50101/swagger
The default ports can be updated in the webServerSettings.json configuration of the Web API service in C:\ProgramData\MHC Software folder, by setting the HttpConfig Port parameter, respectively HttpsConfig Port.
Getting Started
Authentication
NorthStar Essentials uses API keys in order to authenticate requests made by clients. You have to access the webServerSettings.json configuration of the Web API service in C:\ProgramData\MHC Software folder to find the API Key in order to use the Essentials API.
All endpoints require a session token. The token can be obtained using the Authorization service.
Template management
For core-only installations, templates are managed in the file system and can be found in the Management Console/Workspaces, under the default workspace. XML Document samples can be found in Start Menu under MHC Create Samples then access XML Samples. You can find here samples that prove the basic conversion capabilities: MHC Studio Publisher templates and XSL-FO files for XML to PDF conversion, and also DAL files use for document assembly.
Using .NET API
Using the .NET API is very easy and accessible for all users to retrieve and store files in the repository. The .NET assembly contains the client-side object model that needs to be downloaded by following the next section.
Downloading the API
For core-only installations, use the SDK download page, which by default is located at https://localhost:50101/sdk or http://localhost:50100/sdk.
If you are using the cloud version, these can be downloaded from the Developer\Software module, under the Programming tools and API's group section.
Using the API
For core-only installations, you need to make sure to use the correct server name and port number provided by your system administrator:
The code sample below uses the API to convert XML to PDF using a template stored on the NorthStar Essentials server. An XML string is sent to the server and a PDF is received back and downloaded locally.
string apiUrl = "https://api.example.com";
string apiKey = "898d6c1c-057f-4b8a-b429-c0bafa5a1ebf";
string downloadFolder = "C:/Temp/";
string fileName = "sample-xml2pdf.pdf";
try
{
// Authenticate
Configuration configuration = new Configuration() { BasePath = apiUrl };
configuration.DefaultHeaders.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey)));
AuthorizationApi authorizationApi = new AuthorizationApi(configuration);
string sessionToken = authorizationApi.GetToken().AccessToken;
Configuration directRenderApiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
Console.WriteLine("Your token is: {0}", sessionToken);
// Render XML -> PDF
// Create a new Render API
DirectRenderApi renderApi = new DirectRenderApi(directRenderApiConfig);
var xml = "<?xml version=\"1.0\" standalone=\"yes\"?>" +
"<root>" +
"<Invoices>" +
"<Invoice>" +
"<InvoiceProperties>" +
"<number>02116</number>" +
"<date>2016-06-10</date>" +
"</InvoiceProperties>" +
"<CustomerInformation>" +
"<name>Earl Library Co.</name>" +
"<address>1021 South Main Street,Seattle, Washington 92315</address>" +
"<email>sales@earlbook.com</email>" +
"<telephone>(206)321-2345</telephone>" +
"</CustomerInformation>" +
"<Products>" +
"<Product>" +
"<id>1</id>" +
"<name>Rendezvous with Rama by Arthur C. Clarke</name>" +
"<price>15</price>" +
"<quantity>3</quantity>" +
"<total>45</total>" +
"<description>An all-time science fiction classic, Rendezvous with Rama is also one of Clarke's best novels--it won the Campbell, Hugo, Jupiter, and Nebula Awards.</description>" +
"</Product>" +
"</Products>" +
"<Comments>" +
"<comments>Contact us with any questions you may have.</comments>" +
"</Comments>" +
"</Invoice>" +
"</Invoices>" +
"</root>"
// Create a new render request
RenderRequestEntity request = new RenderRequestEntity()
{
InputSettings = new InputSettings()
{
Template = new Template()
{
Workspace = "Default",
Path = @"Bookstore Invoice\Invoice.epr"
}
},
Input = new Input()
{
InputFormat = "xml",
Source = $"data:application/xml;base64,{Convert.ToBase64String(Encoding.UTF8.GetBytes(xml))}"
},
PdfOutput = new PdfOutput()
};
// Send the request
Stream response = renderApi.Render(request);
Console.WriteLine("XML -> PDF rendered ok");
// Download the PDF locally
if (!Directory.Exists(downloadFolder))
Directory.CreateDirectory(downloadFolder);
// Write the file
using (System.IO.Stream newFile = System.IO.File.OpenWrite(downloadFolder + fileName))
{
response.CopyTo(newFile);
}
Console.WriteLine("Downloaded response file to folder: {0}", downloadFolder + fileName);
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
}
Using Java API
The Java API will need the same client-side object model mentioned above written in Java.
Downloading the API
For core-only installations, use the SDK download page, which is by default located at https://api.example.com/sdk or http://localhost:50100/sdk.
If you are using the cloud version, these can be downloaded from the Developer\Software module, under the Programming tools and API's group section.
Using the API
For core-only installations, you need to make sure to use the correct server name and port number provided by your system administrator.
The code snippet below uses the API to convert XML to PDF using a template stored on the NorthStar Essentials server. An XML string is sent to the NorthStar Essentials server and a PDF is received back:
String apiUrl = "https://api.example.com";
String apiKey = "898d6c1c-057f-4b8a-b429-c0bafa5a1ebf";
String downloadFolder = "C:/Temp/";
String fileName = "sample-xml2pdf.pdf";
// Authenticate
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(apiKey.getBytes()));
AuthorizationApi authorizationApi = new AuthorizationApi(client);
String sessionToken = authorizationApi.getToken().getAccessToken();
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
System.out.format("Your token is: %s%n", sessionToken);
// Create RenderRequest
RenderRequestEntity renderRequest = new RenderRequestEntity();
InputSettings inputSettings = new InputSettings();
Template template = new Template();
template.setWorkspace("Default");
template.setPath("Bookstore Invoice\\Invoice.epr");
inputSettings.setTemplate(template);
renderRequest.setInputSettings(inputSettings);
String xml = "<?xml version=\"1.0\" standalone=\"yes\"?>" +
"<root>" +
"<Invoices>" +
"<Invoice>" +
"<InvoiceProperties>" +
"<number>02116</number>" +
"<date>2016-06-10</date>" +
"</InvoiceProperties>" +
"<CustomerInformation>" +
"<name>Earl Library Co.</name>" +
"<address>1021 South Main Street,Seattle, Washington 92315</address>" +
"<email>sales@earlbook.com</email>" +
"<telephone>(206)321-2345</telephone>" +
"</CustomerInformation>" +
"<Products>" +
"<Product>" +
"<id>1</id>" +
"<name>Rendezvous with Rama by Arthur C. Clarke</name>" +
"<price>15</price>" +
"<quantity>3</quantity>" +
"<total>45</total>" +
"<description>An all-time science fiction classic, Rendezvous with Rama is also one of Clarke's best novels--it won the Campbell, Hugo, Jupiter, and Nebula Awards.</description>" +
"</Product>" +
"</Products>" +
"<Comments>" +
"<comments>Contact us with any questions you may have.</comments>" +
"</Comments>" +
"</Invoice>" +
"</Invoices>" +
"</root>";
Input input = new Input();
input.setInputFormat("xml");
input.setSource("data:application/xml;base64," + Base64.getEncoder().encodeToString(xml.getBytes()));
renderRequest.setInput(input);
renderRequest.setPdfOutput(new PdfOutput());
DirectRenderApi renderApi = new DirectRenderApi(client);
// Send the Request
File response = renderApi.render(renderRequest);
// Write the file
byte[] data = Files.readAllBytes(response.toPath());
OutputStream out = new FileOutputStream(new File(downloadFolder + fileName));
out.write(data);
out.close();
System.out.format("File %s downloaded ok%n", downloadFolder + fileName);
Note
The API Reference entities and methods uses a simplified model. You will need to use setters and getters when working with entities, just like it is used in the above example.
General Notes
This section will cover the common errors encountered when using the REST APIs, along with some information about each of them and the accepted time standards.
Error handling
Each API method can throw error and attempts to return appropriate HTTP status codes. Additional info is included in the body of the response, JSON-formatted.
Example:
//400 BadRequest
{
"Message": "Required parameter 'Path' not found."
}
| Code | Text | Description |
|---|---|---|
| 200 | OK | Success! |
| 201 | Created | Resource created. Usually, the response body represents the newly created resource. |
| 204 | No Content | Request processed. Response is intentionally blank e.g. DELETE operations. |
| 400 | Bad Request | The request was invalid or cannot be otherwise served. An accompanying error message will explain further. |
| 401 | Unauthorized | Missing or incorrect credentials. |
| 403 | Forbidden | The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This is usually because of the current authenticated user not having permission to manage the resource. |
| 404 | Not Found | The URI requested is invalid or the resource requested, such as a user, does not exist. |
| 410 | Gone | This resource is gone. Used to indicate that an API endpoint has been turned off. |
| 415 | Unsupported Media Type | The payload is in a format not supported by this method on the target resource. The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly. |
| 500 | Internal Server Error | Something is broken. Additional explanation is included in the response body. |
Dates and durations
This section helps you pay attention when work with date and time and what these parameters do by the time they leave your API platform. NorthStar Essentials solution is to use ISO standards for the time representation.
All dates in the API are strings in the ISO 8601 DateTime format:
"2017-01-26T11:29:35Z"
All durations in the API are string in the ISO 8601 Duration format:
"PT1.52S"
API Reference
This API reference is organized by services and resource type. Each service groups similar resources together and has one or more methods that changes these resources (create, read, update, delete, etc.). All HTTP routes are relative to WebAPI base URI, e.g. api/v2/token refers to https://api.example.com/api/v2/token.
Authorization
In order to make calls to our REST methods, you will need to provide a token. This call uses a basic authentication with configured API Key for generating a session token.
GetToken
Generates the access token used for all API calls.
GET /api/v2/token
To generate an access token, call this method and supply the configured API Key. For more information about API keys, see Authentication.
The response contains an access token that needs to be passed via Authorization header using Basic <SessionTokenBase64> format in order to authorize a generic endpoint.
If you're using our .NET or Java client SDK API this process is simplified (examples below).
Parameters
Authorization- Authorization credentials:<apiKey>
Returns TokenEntity
AccessToken- Access token ofstringtype that can be used in Authorization headers.
Examples
.NET
string apiUrl = "https://api.example.com";
string apiKey = "0ae4af41-b530-4038-be82-a0fa8b3f1d55";
// Authenticate
Configuration configuration = new Configuration() { BasePath = apiUrl };
configuration.DefaultHeaders.Add("Authorization", $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes(apiKey))}");
AuthorizationApi authorizationApi = new AuthorizationApi(configuration);
string sessionToken = authorizationApi.GetToken().AccessToken;
Java
string apiUrl = "https://api.example.com";
string apiKey = "0ae4af41-b530-4038-be82-a0fa8b3f1d55";
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(apiUrl);
apiClient.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(apiKey.getBytes()));
AuthorizationApi authorizationApi = new AuthorizationApi(apiClient);
String sessionToken = authorizationApi.getToken().getAccessToken();
HTTP
curl -X GET --header "Accept: application/json" --header "Authorization: Basic QXBpS2V5OjBhZTRhZjQxLWI1MzAtNDAzOC1iZTgyLWEwZmE4YjNmMWQ1NQ==" "https://api.example.com/api/v2/token"
Direct Data
The Direct Data API call uses diagrams as inputs, built in Modeler.
Data
Process a data model diagram and return the output data as a stream.
POST /api/v2/data
Parameters
AuthorizationRequireddataRequestof typeDataRequestEntityInputSettingsof typeDataInputSettingsDiagramWorkspace- The workspace namePath- The file pathDiagramParameters- A list with string triplets that can be used to overwrite some attributes in the data processing such as a connection string, parameter value, etc.Id- Specifies the id of the XML element on which this property should be applied.Name- Specifies the name of the property (e.g. XML attribute name).Value- Specifies the new value for the attribute that will be overwritten.
Returns
binary data- the output data stream, in a format determined by the input diagram.
Notes
If the diagram format is .edx , then the output will be an XML File.
If the diagram format is .edm, then the output will be an IMDB File.
If the diagram format is .edo, then the output will be a Data Operations Output file.
If the diagram format is .ede, then the output will be an Excel Output file.
Examples
.NET
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration directDataApiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Data API
DirectDataApi dataApi = new DirectDataApi(directDataApiConfig);
DataRequestEntity request = new DataRequestEntity()
{
InputSettings = new DataInputSettings()
{
Diagram = new Diagram()
{
Workspace = "Sample",
Path = "SimpleJob.edx"
}
}
};
// Send the request
using(Stream response = dataApi.Data(request))
{
//processing
}
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Data API
DirectDataApi dataApi = new DirectDataApi(client);
// Create a new request
DataRequestEntity request = new DataRequestEntity();
DataInputSettings inputSettings = new DataInputSettings ();
Diagram diagram = new Diagram ();
diagram.setWorkspace("Sample");
diagram.setPath("SimpleJob.edx");
inputSettings.setDiagram(diagram);
request.setInputSettings(inputSettings);
// Send the request
File response = dataApi.data(request);
HTTP
curl -H "Content-Type: application/json" -X POST -d "{ 'InputSettings' : { 'Diagram' : { 'Workspace' : 'Simple', 'Path' : 'SimpleJob.edx' } }" -H "Authorization: Basic NGI4YTg1MTgtZjU0NC00N2NhLWFmMmMtMzBmYzBlODU1NzU3" "https://api.example.com/api/v2/data"
Direct Render
The Direct Render API call allows you to configure what type of output you would like to produce, what template to use and other variables that will drive this to production. In this section, you will have access to the different configuration options for each output type.
Render
Render input into a variety of output formats including PDF, Word, etc.
POST /api/v2/render
Render Parameters
requestof typeRenderRequestEntity(Model.RenderRequestEntity)Required- Input (Model.Input, optional) : Input configuration
- InputSettings (Model.InputSettings, optional) : Input settings
- HtmlInput (Model.HtmlInput, optional) : HTML Input
- PdfOutput (Model.PdfOutput, optional) : PDF Output
- HtmlOutput (Model.HtmlOutput, optional) : HTML Output
- TxtOutput (Model.TxtOutput, optional) : Text Output
Returns
binary data- the output document, in a format determined by the request output settings.- The response header will return back the render statistics
x-render-stats-page-count- returns the page count of the generated documentx-render-input-bytes-id- returns the InputBytesID from the request, if specified
Input
- Model.Input - You can specify either a
Sourceor a combination of anWorkspaceandPath.RequiredInputFormat(string, optional) - Format of the source document- Allowed Values:
pdf,xslfo,svg,xml,wordml,docx,html,dal,das,xfd,excel,json
- Allowed Values:
Source(string, optional) - String representing the source document Base64 encoded by using the following formatdata:<media-type>;base64,<data>, e.g.data:application/json;base64,eyJyb290IjogIkhlbGxvV29ybGQhIn0=. For large content, provide a Base64 encoded zip archive usingdata:application/xml;base64,<data>format.Workspace(string, optional) - The name of the workspace of your inputPath(string, optional) - The input file path
Input Settings
- Model.InputSettings
ReferenceResolver(string, optional) - Specifies the reference resolver behavior. The reference resolver is a separate pre-processing step which solves dynamic fields which are layout-dependent, e.g. page numbers, indexes. It can be set to run before starting to produce pages, in parallel with producing pages, or not at all (in which case some fields may not appear in the document). By default, it will use parallel if available (based on your license) or serial if not.- Allowed Values:
parallel,serial,disabled - Default:
parallel
- Allowed Values:
FontErrors(string, optional) - Specifies what to do when a font is not found. By default, it will use the default font, but it can also be set to throw an error.- Allowed Values:
usedefault,throw - Default:
usedefault
- Allowed Values:
ImageErrors(string, optional) - Specifies what to do when an image is not found or cannot be processed. By default, it will use a stock image, but it can also be set to throw an error or ignore the missing element and not render any placeholder.- Allowed Values:
usestock,throw,ignore - Default:
usestock
- Allowed Values:
InputBytesID(string, optional) - Helps correlate the request sent to the render in the log file. The value can be any string (e.g. a GUID); afterward you can search for it in the NorthStar CCM logs.- Template (Model.Template, optional) : Specifies the document template
Input Template
- Model.Template
Workspace(string, optional) - The workspace namePath(string, optional) - The file pathLanguageId(string, optional) - Language idPreserveWhitespace(string, optional) - Specifies if whitespace is preserved in the template.- Allowed Values:
Yes,No
- Allowed Values:
XSLTEngine(string, optional) - The XSL Transformation EngineMSXML- A very fast XSL 1.0 engine; support for JavaScript.DotNet20- An XSL Engine used to create compiled XSLT Templates.Saxon- An XSL Engine best for low memory consumption; support for XSL 1.0 and XSL 2.0. No support for JavaInternal- Use built-in libXslt engine.
UseCompileTemplates(boolean, optional) - Optimizes the Server Templates by generating a cache with the compiled template and reduces compilation time at every Render step.- Allowed Values:
true,false
- Allowed Values:
TemplateParameters(object, optional) - A key-value mapping that sets template parameters.Name- Template parameter nameValue- Template parameter value
HTML Input
- Model.HtmlInput - HTML input settings
Encoding(string, optional) - Specifies the character encoding of the input HTML document- Allowed Values:
utf8,win1252 - Default:
utf8
- Allowed Values:
PageWidth(string, optional) - Specifies the page width as a length value or automatic.- Default:
auto
- Default:
PageHeight(string, optional) - Specifies the page height as a length value or automatic.- Default:
auto
- Default:
PageMarginTop(string, optional) - Specifies the page top margin as a length value.- Default:
1in
- Default:
PageMarginLeft(string, optional) - Specifies the page left margin as a length value.- Default:
1in
- Default:
PageMarginRight(string, optional) - Specifies the page right margin as a length value.- Default:
1in
- Default:
PageMarginBottom(string, optional) - Specifies the page bottom margin as a length value.- Default:
1in
- Default:
PageHeaderMargin(string, optional) - Specifies the page header margin as a length value.- Default:
0.5in
- Default:
PageFooterMargin(string, optional) - Specifies the page footer margin as a length value.- Default:
0.5in
- Default:
ShowPageNumber(boolean, optional) - Specifies whether to render page numbers in the output.- Default:
true
- Default:
ShowTitle(boolean, optional) - Specifies whether to render page title in the output.- Default:
true
- Default:
PDF Output
- Model.PdfOutput - PDF is the default output if none specified.
PrefixFontSubset(boolean, optional) - Specifies whether to add prefixes to the names of subsetted fonts in the internal structure of the output PDF.EmbedTTF(boolean, optional) - Specifies whether to embed TrueType fonts.HideToolbar(boolean, optional) - Specifies whether to hide the PDF viewer menubar.HideMenubar(boolean, optional) - Specifies whether to hide the PDF viewer menubar.HideWindowUI(boolean, optional) - Specifies whether to hide the PDF viewer window UI.FitWindow(boolean, optional) - Specifies whether the output PDF should fit the window when opened.CenterWindow(boolean, optional) - Specifies whether the output PDF should center in the window when opened.DisplayDocTitle(boolean, optional) - Specifies whether to display the title of the output PDF.Conformance(string, optional, deprecated) - Specifies the level of PDF conformance. This parameter is deprecated and should no longer be used. Instead, useDocumentConformanceto define the PDF conformance standard andDocumentAccessibilityto to specify the desired accessibility level.- Allowed Values:
none,pdfx,pdfa-1a,pdfa-1a-accesible,pdfa-1b,pdf508,pdfx4p,pdfx4,pdfwcag2.0,pdfwcag2.1
- Allowed Values:
DocumentConformance(string, optional) Specifies the level of PDF conformance.- Allowed Values:
pdf-a-1a,pdf-a-1b,pdf-a-2a,pdf-a-2b,pdf-a-2u,pdf-a-3a,pdf-a-3b,pdf-a-3u,pdf-a-4,pdf-a-4f,pdf-x-1,pdf-x-2,pdf-x-3,pdf-x-4,pdf-x-4p,pdf-ua-1,pdf-ua-2
- Allowed Values:
DocumentAccessibility(string, optional) Specifies the level of PDF accessibility.- Allowed Values:
pdf-ua-1,pdf-ua-2,pdf-wcag-20-a,pdf-wcag-20-aa,pdf-wcag-20-aaa,pdf-wcag-21-a,pdf-wcag-21-aa,pdf-wcag-21-aaa,pdf-wcag-22-a,pdf-wcag-22-aa,pdf-wcag-22-aaa
- Allowed Values:
Version(string, optional) - Specifies the PDF version.- Allowed Values:
pdf16,pdf14,pdf15,pdf17,pdf20 - Default:
pdf16
- Allowed Values:
WritePDFA3Source(string, optional) Specifies whether the input file should be embedded in the generated PDF when PDF/A-3 conformance is enabled.- Allowed Values:
auto,input. By default, the input embedding is disabled.
- Allowed Values:
WritePDFA3SourceXpath(string, optional) Specifies the XPath expression used to identify the portion of the input file that should be embedded in the generated PDF when PDF/A-3 conformance is enabled.AllowPrinting(boolean, optional) - If owner-password is set, this can be set to allow printing.AllowModifyContents(boolean, optional) - If owner-password is set, this can be set to allow editing.AllowCopy(boolean, optional) - If owner-password is set, this can be set to allow copying.AllowModifyAnnotations(boolean, optional) - If owner-password is set, this can be set to allow manipulating annotations.AllowFillIn(boolean, optional) - If owner-password is set, this can be set to allow filling in forms.AllowScreenReaders(boolean, optional) - If owner-password is set, this can be set to allow screen readers.AllowAssembly(boolean, optional) - If owner-password is set, this can be set to allow document assembly.AllowDegradedPrinting(boolean, optional) - If owner-password is set, this can be set to allow degraded printing.ImageCompression(string, optional) - Specifies the type of image compression.- Allowed Values:
jpeg,flat - Default:
jpeg
- Allowed Values:
OwnerPassword(string, optional) - Set an owner password to a string value. This presents the user with a prompt to enter the password when attempting to edit the document. It is used in conjunction with the encryption-strength field and the allow-* fields to encrypt the document bytes and enable granular permissions on the document (although the password can be read from the document to decrypt the contents).UserPassword(string, optional) - Set a user password to a string value. This presents the user with a prompt to enter the password when opening the document. It is used in conjunction with the encryption-strength field to encrypt the document bytes.PDFMergeFonts(string, optional) - Specify the way fonts are generated in the final output. It is useful to reduce the size of the output when merging PDFs.- Allowed Values:
true- set the font to be embedded,false- set the font to not be embedded (it is based on the System Fonts from Windows),empty- takes the font value from the configuration file.
- Allowed Values:
EncryptionsStrength(integer, optional) - If a password is set, specifies the strength with which to encrypt the document.- Allowed Values:
48,128 - Default:
48
- Allowed Values:
DigitalSignature(boolean, optional) - Specifies if the PDF output generated is signed using a Digital Signature Certificate. Note that the Digital Signature needs to be configured in your Sysadmin website.
HTML Output
- Model.HtmlOutput - HTML output that contains a web document
HideStaticContent(boolean, optional) - Skip rendering of static content elements (headers, footers, etc.) in HTML output.GenerateHtmlDocument(boolean, optional) - Specifies whether to wrap the generated HTML content to form a full HTML document, i.e. html, head, and body tags.UseFixedBodyWidth(boolean, optional) - Specifies whether to use a fixed width to approximate a paginated document layout or a fluid layout based on the window size.RenderedImagesBaseUrl(string, optional) - Specifies where to look for images and other resources linked with relative paths. All relative paths will be resolved relative to this URL. While not required, it is recommended for consistency. Defaults to the current directory.InteractiveWidgets(boolean, optional) - Specifies whether to render BI widgets as interactive or static.RenderedImagesOutputFolder(string, optional_) - Specifies the output folder for the rendered images.EmbedImageMode(string, optional) - specifies how an image should be embedded in an HTML output.- Allowed Values:
base64- Embeds images as base64 in html output,cid- Makes zip with html and images,preserveurl- If the input contains http/https referenced image it will preserve the URL in HTML output. **Note: The image that is embedded in base64 will remain embedded. ** - Default:
base64
- Allowed Values:
TXT Output
- Model.TxtOutput - Text Output that exports data to a text file
Encoding(string, optional) - Specifies the output file encoding.- Allowed Values:
utf-8,utf-16,ascii - Default:
ascii
- Allowed Values:
FormFeed(boolean, optional) - Specifies whether to separate pages using the form feed character.IgnoreCssBoxAttributes(boolean, optional) - Specifies whether to ignore CSS box attributes or perform layout on the document, spacing out the text vertically and horizontally in order to approximate the original layout.TrimPages(boolean, optional) - Specifies whether to trim whitespace off pages.LineHeight(number, optional) - Specifies the value in points to assume as the output's line height.- Default:
1.4
- Default:
FontSize(integer, optional) - Specifies the value in points to assume as the output's font size.- Default:
9
- Default:
FontFamily(integer, optional) - Specifies the font family to assume will be used in the output.- Default:
Courier New
- Default:
Page Count
Returns the page count of the result of a render task.
POST /api/v2/pagecount
Parameters
Examples
.NET
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration directRenderApiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() {
{ "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) }
}
};
// Create a new Render API
DirectRenderApi renderApi = new DirectRenderApi(directRenderApiConfig);
var xml = "<?xml version=\"1.0\" standalone=\"yes\"?><root><Invoices><Invoice><InvoiceProperties><number>02116</number><date>2016-06-10</date></InvoiceProperties><CustomerInformation><name>Earl Library Co.</name><address>1021 South Main Street, Seattle, Washington 92315</address><email>sales@earlbook.com</email><telephone>(206)321-2345</telephone></CustomerInformation><Products><Product><id>1</id><name>Rendezvous with Rama by Arthur C. Clarke</name><price>15</price><quantity>3</quantity><total>45</total><description>An all-time science fiction classic, Rendezvous with Rama is also one of Clarke's best novels--it won the Campbell, Hugo, Jupiter, and Nebula Awards.</description></Product></Products><Comments><comments>Contact us with any questions you may have.</comments></Comments></Invoice></Invoices></root>";
// Create a new request
RenderRequestEntity request = new RenderRequestEntity()
{
InputSettings = new InputSettings()
{
Template = new Template()
{
Workspace = "Default",
Path = @"Bookstore Invoice\Invoice.epr"
}
},
Input = new Input()
{
InputFormat = "xml",
Source = $"data:application/xml;base64,{Convert.ToBase64String(Encoding.UTF8.GetBytes(xml))}"
},
PdfOutput = new PdfOutput()
};
// Send the request
using(Stream response = renderApi.Render(request))
{
//processing
}
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Render API
DirectRenderApi renderApi = new DirectRenderApi(client);
// Create a new request
RenderRequestEntity request = new RenderRequestEntity();
InputSettings inputSettings = new InputSettings();
Template template = new Template();
template.setWorkspace("Default");
template.setPath("Bookstore Invoice/Invoice.epr");
inputSettings.setTemplate(template);
request.setInputSettings(inputSettings);
String xml = "<?xml version=\"1.0\" standalone=\"yes\"?><root><Invoices><Invoice><InvoiceProperties><number>02116</number><date>2016-06-10</date></InvoiceProperties><CustomerInformation><name>Earl Library Co.</name><address>1021 South Main Street, Seattle, Washington 92315</address><email>sales@earlbook.com</email><telephone>(206)321-2345</telephone></CustomerInformation><Products><Product><id>1</id><name>Rendezvous with Rama by Arthur C. Clarke</name><price>15</price><quantity>3</quantity><total>45</total><description>An all-time science fiction classic, Rendezvous with Rama is also one of Clarke's best novels--it won the Campbell, Hugo, Jupiter, and Nebula Awards.</description></Product></Products><Comments><comments>Contact us with any questions you may have.</comments></Comments></Invoice></Invoices></root>";
Input input = new Input();
input.setInputFormat("xml");
input.setSource("data:application/xml;base64," + Base64.getEncoder().encodeToString(xml.getBytes()));
request.setInput(input);
request.setPdfOutput(new PdfOutput());
// Send the request
File response = renderApi.render(request);
HTTP
curl -H "Content-Type: application/json" -X POST -H "Authorization: Basic VE9LRU46NGI4YTg1MTgtZjU0NC00N2NhLWFmMmMtMzBmYzBlODU1NzU3" -d "{ 'Input' : { 'Source' : 'data:application/xml;base64,PD94bWwgdmVyc2lvbj1cIjEuMFwiIHN0YW5kYWxvbmU9XCJ5ZXNcIj8+PHJvb3Q+PC9yb290Pg==' }, 'InputSettings' : { 'Template' : { 'Workspace' : 'Default', 'Path' : 'Bookstore Invoice/Invoice.epr' } }, 'TxtOutput' : {}}" "https://api.example.com/api/v2/render"
Repository
NorthStar Essentials repository stores all assets involved in document production (images, templates, stylesheets, diagrams etc.) in a file repository. The installation provides a basic level of functionality.
Publishing Repository Methods:
- FilesApi.GetFiles
- FilesApi.UpdateFile
- FilesApi.DeleteFile
- FileContentApi.DownloadFile
- FileContentApi.UploadFile
- FoldersApi.CreateFolder
- FoldersApi.GetFolders
- FoldersApi.DeleteFolder
- FoldersContentApi.ExportFolder
- FoldersContentApi.ImportFolder
Entities:
GetFiles
Returns a list of files from the Publishing repository.
GET /api/v2/files
Parameters
workspace- Workspace name. Requiredpath- Path to the folder containing the files or a file path1. Requiredstart- Start index- Default:
0
- Default:
count- Number of results- Default:
Int32.MaxValue
- Default:
Notes
1. If the path is a file the result will contain a list of one file metadata from the specified file path.
2. To search files after a tag you need to specify both tagName and tagValue.
Returns FileEntity[] - A list of FileEntity
Path- Path to the fileWorkspace- The workspace name in which the file is locatedCreatedDate- The date when the current version was created (see Date Format)Type- A friendly file type name (e.g."PDF File")Bytes- The file size in bytes
Examples
.NET
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration repositoryApiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Files API
FilesApi filesApi = new FilesApi(apiConfig);
// Send the request
List<FileEntity> files = filesApi.GetFiles("Default", "Bookstore Invoice");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Files API
FilesApi filesApi = new FilesApi(client);
// Send the request
List<FileEntity> files = filesApi.getFiles("Default", "Bookstore Invoice", 0, 10);
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/files?workspace=Default&path=Bookstore%20Invoice"
__
UpdateFile
Rename, copy or move a file in the Publishing repository.
PUT /api/v2/files
Parameters
workspace- Workspace name. Requiredpath- Path to the file on which to perform the action. RequiredfileOperation- of typeFileOperationEntity. RequiredPath- The new file path. RequiredAction- The action to perform on file. Can berename,copyormove. RequiredOverwrite- Specifies how to resolve the conflict if the new file path exists- Allowed values:
true,false - Default:
false
- Allowed values:
Returns
204 (No Content)- HTTP status code
Examples
.NET
//duplicate Invoice.epr as Invoice2.epr
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Files API
FilesApi filesApi = new FilesApi(apiConfig);
// Send the request
filesApi.UpdateFile("Default", "Bookstore Invoice/Invoice.epr",
new FileOperationEntity()
{
Path = "Bookstore Invoice/Invoice2.epr",
Action = "copy",
Overwrite = true
});
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Files API
FilesApi filesApi = new FilesApi(client);
FileOperationEntity op = new FileOperationEntity();
op.setPath("Bookstore Invoice/Invoice2.epr");
op.setAction("copy");
op.setOverwrite(true);
// Send the request
filesApi.updateFile("Default", "Bookstore Invoice/Invoice.epr", op);
HTTP
curl -H "Content-Type: application/json" -X PUT -d "{ 'Path':'Bookstore Invoice/Invoice2.epr', Action:'copy' }" -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/files?workspace=Default&path=Bookstore%20Invoice/Invoice.epr"
__
DeleteFile
Delete a file from the Publishing repository.
DELETE /api/v2/files
Parameters
workspace- Workspace name Requiredpath- The path of the file to be deleted Required
Returns
204 (No Content)- HTTP status code
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Files API
FilesApi filesApi = new FilesApi(apiConfig);
// Send the request
filesApi.DeleteFile("Default", "Bookstore Invoice/Invoice.epr");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Files API
FilesApi filesApi = new FilesApi(client);
// Send the request
filesApi.deleteFile("Default", "Bookstore Invoice/Invoice.epr");
HTTP
curl -X DELETE -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/files?workspace=Default&path=Bookstore%20Invoice/Invoice.epr"
__
DownloadFile
Download a file from the Publishing repository.
GET /api/v2/files/content
Parameters
workspace- Workspace name Requiredpath- File path Required
Returns
binary data- File bytes
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new File Content API
FileContentApi fileContentApi = new FileContentApi(apiConfig);
// Send the request
Stream response = fileContentApi.DownloadFile("Default", "Bookstore Invoice/Invoice.epr");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new File Content API
FileContentApi fileContentApi = new FileContentApi(client);
// Send the request
File response = fileContentApi.downloadFile("Default", "Bookstore Invoice/Invoice.epr");
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/files/content?workspace=Default&path=Bookstore%20Invoice/Invoice.epr"
__
UploadFile
Upload a file to the Publishing repository.
POST /api/v2/files/content
Parameters
workspace- Workspace name. Requiredpath- File path. Requiredfile- The file to upload. Required
Returns
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new File Content API
FileContentApi fileContentApi = new FileContentApi(apiConfig);
using (Stream stm = File.OpenRead(@"C:\Temp\Sample.xml", FileMode.Open, FileAccess.Read))
{
// Send the request
FileEntity newFile = fileContentApi.UploadFile("Default", "Bookstore Invoice/Sample.xml", stm);
}
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new File Content API
FileContentApi fileContentApi = new FileContentApi(client);
java.io.File uploadFile = new java.io.File("C:\\Sample.xml");
// Send the request
FileEntity newFile = fileContentApi.uploadFile(token, "Default", "Bookstore Invoice/Sample.xml", uploadFile);
HTTP
curl -X POST -F "file=@C:\Sample.xml" -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/files/content?workspace=Default&path=Bookstore%20Invoice/Sample.xml"
__
CreateFolder
Create a new folder in the Publishing repository.
POST /api/v2/folders
Parameters
workspace- Workspace name. Requiredpath- Folder path. Required
Returns
201 (Created)- HTTP status code
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Folders API
FoldersApi foldersApi = new FoldersApi(apiConfig);
// Send the request
foldersApi.CreateFolder("Default", "NewFolder");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Folders API
FoldersApi foldersApi = new FoldersApi(client);
// Send the request
foldersApi.createFolder("Default", "NewFolder");
HTTP
curl -X POST -d "{'path' : 'NewFolder'}" -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/folders?workspace=Default&path=NewFolder"
__
GetFolders
Returns a list of folders in the specified parent path and workspace from the Publishing repository.
GET /api/v2/folders
Parameters
workspace- Workspace name. Requiredpath- Folder path. Requiredstart- Start indexcount- Number of results
Returns FolderEntity[] - A list of FolderEntity
Path- Path to the folderWorkspace- Workspace name in which the folder is locatedCreatedDate- Date when the folder was created (see Date Format)FilesCount- Total number of files inside the folder (non recursive)FoldersCount- Total number of folders inside the folder (non recursive)
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Folders API
FoldersApi foldersApi = new FoldersApi(client);
// Send the request
List<FolderEntity> folders = foldersApi.GetFolders("Default", "Bookstore Invoice");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Folders API
FoldersApi foldersApi = new FoldersApi(client);
// Send the request
List<FolderEntity> folders = foldersApi.getFolders("Default", "Bookstore Invoice", 0, 10);
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/folders?workspace=Default&path=Bookstore%20Invoice"
__
DeleteFolder
Delete an existing folder from the Publishing repository.
DELETE /api/v2/folders
Parameters
workspace- Workspace name. Requiredpath- Folder path. Required
Returns
204 (No Content)- HTTP status code
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Folders API
FoldersApi foldersApi = new FoldersApi(client);
// Send the request
foldersApi.DeleteFolder("Default", "Bookstore Invoice");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Folders API
FoldersApi foldersApi = new FoldersApi(client);
// Send the request
foldersApi.deleteFolder("Default", "Bookstore Invoice");
HTTP
curl -X DELETE -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/folders?workspace=Default&path=Bookstore%20Invoice"
ExportFolder
Download a zip file of a folder from the Publishing repository.
GET /api/v2/folders/content
Parameters
workspace- Workspace name. Requiredpath- Path to the folder to be exported. Required
Returns
binary data- the zip file
Examples
.NET
// Export Bookstore Invoice folder
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Folders Content API
FoldersContentApi foldersContentApi = new FoldersContentApi(apiConfig);
// Send the request
Stream zip = foldersContentApi.ExportFolder("Default", "Bookstore Invoice");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Folders Content API
FoldersContentApi foldersContentApi = new FoldersContentApi(client);
// Send the request
File zip = foldersContentApi.exportFolder("Default", "Retail/Bookstore Invoice");
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/folders/content?workspace=Default&path=Bookstore%20Invoice"
__
ImportFolder
Decompress an archive and uploads its content to the Publishing repository.
POST /api/v2/folders/content
Parameters
workspace- Workspace name. Requiredpath- Folder path. Requiredfile- Zip file bytes. Required
Returns
Examples
.NET
// Import 'myFolder' to Bookstore Invoice folder
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Folders Content API
FoldersContentApi foldersContentApi = new FoldersContentApi(client);
using (Stream zip = File.OpenRead(@"C:\Sample.zip"))
{
// Send the request
FolderEntity folder = foldersContentApi.ImportFolder("Default", "Bookstore Invoice/", zip);
}
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Folders Content API
FoldersContentApi foldersContentApi = new FoldersContentApi(client);
File fileSource = new File("C:\\Sample.zip");
// Send the request
foldersContentApi.importFolder("Default", "Bookstore Invoice", fileSource);
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" -F filedata=@"C:\myFolder.zip" "https://api.example.com/api/v2/folders/content?workspace=Default&path=Bookstore%20Invoice"
Data Repository Methods:
- DiagramFilesApi.DiagramGetFiles
- DiagramFilesApi.DiagramUpdateFile
- DiagramFilesApi.DiagramDeleteFile
- DiagramFileContentApi.DiagramDownloadFile
- DiagramFileContentApi.DiagramUploadFile
- DiagramFoldersApi.DiagramCreateFolder
- DiagramFoldersApi.DiagramGetFolders
- DiagramFoldersApi.DiagramDeleteFolder
- DiagramFoldersContentApi.DiagramExportFolder
- DiagramFoldersContentApi.DiagramImportFolder
Entities:
DiagramGetFiles
Returns a list of files from the Data repository.
GET /api/v2/diagram/files
Parameters
workspace- Workspace name. Requiredpath- Path to the folder containing the files or a file path1. Requiredstart- Start index- Default:
0
- Default:
count- Number of results- Default:
Int32.MaxValue
- Default:
Notes
1. If the path is a file the result will contain a list of one file metadata from the specified file path.
2. To search files after a tag you need to specify both tagName and tagValue.
Returns Data FileEntity[] - A list of FileEntity
Path- Path to the fileWorkspace- The workspace name in which the file is locatedCreatedDate- The date when the current version was created (see Date Format)Type- A friendly file type name (e.g."Diagram File")Bytes- The file size in bytes
Examples
.NET
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration repositoryApiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Files API
DiagramFilesApi filesApi = new DiagramFilesApi(apiConfig);
// Send the request
List<FileEntity> files = filesApi.DiagramGetFiles("Sample", "/");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Files API
DiagramFilesApi filesApi = new DiagramFilesApi(client);
// Send the request
List<FileEntity> files = filesApi.diagramGetFiles("Sample", "/", 0, 10);
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/files?workspace=Sample&path=/"
__
DiagramUpdateFile
Rename, copy or move a file in the Data repository.
PUT /api/v2/diagram/files
Parameters
workspace- Workspace name. Requiredpath- Path to the file on which to perform the action. RequiredfileOperation- of typeFileOperationEntity. RequiredPath- The new file path. RequiredAction- The action to perform on file. Can berename,copyormove. RequiredOverwrite- Specifies how to resolve the conflict if the new file path exists- Allowed values:
true,false - Default:
false
- Allowed values:
Returns
204 (No Content)- HTTP status code
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram Files API
DiagramFilesApi filesApi = new DiagramFilesApi(apiConfig);
// Send the request
filesApi.DiagramUpdateFile("Sample", "SimpleJob.edx",
new FileOperationEntity()
{
Path = "SimpleJob2.edx",
Action = "copy",
Overwrite = true
});
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram Files API
DiagramFilesApi filesApi = new DiagramFilesApi(client);
FileOperationEntity op = new FileOperationEntity();
op.setPath("SimpleJob2.edx");
op.setAction("copy");
op.setOverwrite(true);
// Send the request
filesApi.digramUpdateFile("Sample", "SimpleJob.edx", op);
HTTP
curl -H "Content-Type: application/json" -X PUT -d "{ 'Path':'SimpleJob2.edx', Action:'copy' }" -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/files?workspace=Sample&path=SimpleJob.edx"
__
DiagramDeleteFile
Delete a file from the Data repository.
DELETE /api/v2/diagram/files
Parameters
workspace- Workspace name Requiredpath- The path of the file to be deleted Required
Returns
204 (No Content)- HTTP status code
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram Files API
DiagramFilesApi filesApi = new DiagramFilesApi(apiConfig);
// Send the request
filesApi.DiagramDeleteFile("Sample", "SimpleJob.edx");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram Files API
DiagramFilesApi filesApi = new DiagramFilesApi(client);
// Send the request
filesApi.diagramDeleteFile("Sample", "SimpleJob.edx");
HTTP
curl -X DELETE -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/files?workspace=Sample&path=SimpleJob.edx"
__
DiagramDownloadFile
Download a file from the Data repository.
GET /api/v2/diagram/files/content
Parameters
workspace- Workspace name Requiredpath- File path Required
Returns
binary data- File bytes
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram File Content API
DiagramFileContentApi fileContentApi = new DiagramFileContentApi(apiConfig);
// Send the request
Stream response = fileContentApi.DiagramDownloadFile("Sample", "SimpleJob.edx");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram File Content API
DiagramFileContentApi fileContentApi = new DiagramFileContentApi(client);
// Send the request
File response = fileContentApi.diagramDownloadFile("Sample", "SimpleJob.edx");
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/files/content?workspace=Sample&path=SimpleJob.edx"
__
DiagramUploadFile
Upload a file to the Data repository.
POST /api/v2/diagram/files/content
Parameters
workspace- Workspace name. Requiredpath- File path. Requiredfile- The file to upload. Required
Returns
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram File Content API
DigramFileContentApi fileContentApi = new DiagramFileContentApi(apiConfig);
using (Stream stm = File.OpenRead(@"C:\Temp\Sample.xml", FileMode.Open, FileAccess.Read))
{
// Send the request
FileEntity newFile = fileContentApi.DiagramUploadFile("Sample", "Sample.xml", stm);
}
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram File Content API
DiagramFileContentApi fileContentApi = new DiagramFileContentApi(client);
java.io.File uploadFile = new java.io.File("C:\\Sample.xml");
// Send the request
FileEntity newFile = fileContentApi.diagramUploadFile(token, "Default", "Sample.xml", uploadFile);
HTTP
curl -X POST -F "file=@C:\Sample.xml" -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/files/content?workspace=Sample&path=Sample.xml"
__
DiagramCreateFolder
Create a new folder in the Data repository.
POST /api/v2/diagram/folders
Parameters
workspace- Workspace name. Requiredpath- Folder path. Required
Returns
201 (Created)- HTTP status code
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram Folders API
DiagramFoldersApi foldersApi = new DiagramFoldersApi(apiConfig);
// Send the request
foldersApi.DiagramCreateFolder("Sample", "NewFolder");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram Folders API
DiagramFoldersApi foldersApi = new DiagramFoldersApi(client);
// Send the request
foldersApi.diagramCreateFolder("Sample", "NewFolder");
HTTP
curl -X POST -d "{'path' : 'NewFolder'}" -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/folders?workspace=Sample&path=NewFolder"
__
DiagramGetFolders
Returns a list of folders in the specified parent path and workspace from the Data repository.
GET /api/v2/diagram/folders
Parameters
workspace- Workspace name. Requiredpath- Folder path. Requiredstart- Start indexcount- Number of results
Returns Data FolderEntity[] - A list of FolderEntity
Path- Path to the folderWorkspace- Workspace name in which the folder is locatedCreatedDate- Date when the folder was created (see Date Format)FilesCount- Total number of files inside the folder (non recursive)FoldersCount- Total number of folders inside the folder (non recursive)
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram Folders API
DiagramFoldersApi foldersApi = new DiagramFoldersApi(client);
// Send the request
List<FolderEntity> folders = foldersApi.DiagramGetFolders("Sample", "/");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram Folders API
DiagramFoldersApi foldersApi = new DiagramFoldersApi(client);
// Send the request
List<FolderEntity> folders = foldersApi.diagramGetFolders("Sample", "/", 0, 10);
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/folders?workspace=Sample&path=/"
__
DiagramDeleteFolder
Delete an existing folder from the Data repository.
DELETE /api/v2/diagram/folders
Parameters
workspace- Workspace name. Requiredpath- Folder path. Required
Returns
204 (No Content)- HTTP status code
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram Folders API
DiagramFoldersApi foldersApi = new DiagramFoldersApi(client);
// Send the request
foldersApi.DiagramDeleteFolder("Sample", "Folder");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram Folders API
DiagramFoldersApi foldersApi = new DiagramFoldersApi(client);
// Send the request
foldersApi.diagramDeleteFolder("Sample", "Folder");
HTTP
curl -X DELETE -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/folders?workspace=Sample&path=Folder"
DiagramExportFolder
Download a zip file of a folder from the Data repository.
GET /api/v2/diagram/folders/content
Parameters
workspace- Workspace name. Requiredpath- Path to the folder to be exported. Required
Returns
binary data- the zip file
Examples
.NET
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram Folders Content API
DiagramFoldersContentApi foldersContentApi = new DiagramFoldersContentApi(apiConfig);
// Send the request
Stream zip = foldersContentApi.DiagramExportFolder("Sample", "/");
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram Folders Content API
DiagramFoldersContentApi foldersContentApi = new DiagramFoldersContentApi(client);
// Send the request
File zip = foldersContentApi.diagramExportFolder("Sample", "/");
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" "https://api.example.com/api/v2/diagram/folders/content?workspace=Sample&path=/"
__
DiagramImportFolder
Decompress an archive and uploads its content to the Data repository.
POST /api/v2/diagram/folders/content
Parameters
workspace- Workspace name. Requiredpath- Folder path. Requiredfile- Zip file bytes. Required
Returns
Examples
.NET
// Import 'myFolder' to Bookstore Invoice folder
string apiUrl = "https://api.example.com";
string sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
Configuration apiConfig = new Configuration()
{
BasePath = apiUrl,
DefaultHeaders = new Dictionary<string, string>() { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionToken)) } }
};
// Create a new Diagram Folders Content API
DiagramFoldersContentApi foldersContentApi = new DiagramFoldersContentApi(client);
using (Stream zip = File.OpenRead(@"C:\Sample.zip"))
{
// Send the request
FolderEntity folder = foldersContentApi.DiagramImportFolder("Sample", "/", zip);
}
Java
String apiUrl = "https://api.example.com";
String sessionToken = "c87ca566-2587-4480-8a7a-27531f04af80";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
client.addDefaultHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(sessionToken.getBytes()));
// Create a new Diagram Folders Content API
DiagramFoldersContentApi foldersContentApi = new DiagramFoldersContentApi(client);
File fileSource = new File("C:\\Sample.zip");
// Send the request
foldersContentApi.diagramImportFolder("Sample", "/", fileSource);
HTTP
curl -H "Authorization: Basic Yzg3Y2E1NjYtMjU4Ny00NDgwLThhN2EtMjc1MzFmMDRhZjgw" -F filedata=@"C:\myFolder.zip" "https://api.example.com/api/v2/diagram/folders/content?workspace=Sample&path=/"
Status
The Status API call uses the status of a HTTP response message to inform users about the server.
GetStatus
Get information about the server: Name, Version, Build number and Status.
GET /api/v2/status
Returns StatusEntity
StatusCode- The code of the server status:0- Both Publishing Engine and Data Engine are available.1- Data Engine is NOT available.2- Publishing Engine is NOT available.3- Both Publishing Engine and Data Engine are NOT available.
Status Description- The description of the server status
Examples
.NET
string apiUrl = "https://api.example.com";
// Create a new Status API
StatusApi statusApi = new StatusApi(apiUrl);
// Send the request
StatusEntity status = statusApi.Status();
Java
String apiUrl = "https://api.example.com";
ApiClient client = new ApiClient();
client.setBasePath(apiUrl);
// Create a new Status API
StatusApi statusApi = new StatusApi(client);
// Send the request
StatusEntity status = statusApi.status();
HTTP
curl -X GET "https://api.example.com/api/v2/status"