Warning
This API is outdated. Visit Ecrion Develop API 12.0 to access the latest version of the Ecrion API.
Ecrion 11.5 Develop API Guide
This guide will walk a customer through the available Application Programming Interfaces (API v2) endpoints for the Develop solution of the Ecrion Platform version 11.5 (Mantine) and later.
Introducing Ecrion API 2
Using this API, software programmers are able to produce documents in high volumes and manage customer communications, according to the different Ecrion layers.
Ecrion Develop
- 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 Ecrion Studio to control layout, styles, colors and other visual aspects.
- Implement security using users and groups(not available in core-only installations).
- Versionable repository and asset management (not available in core-only installations).
Ecrion provides the following APIs:
Javascriptfor web programmers through the inclusion ofEcrion.EOS.Client.2.0.jsC#for .NET programmers by adding a reference to theEcrion.EOS.Client.2.0.NET.dllassemblyJavafor Java programmers through theEcrion.EOS.Client.2.0.Java.jarpackage
Notes
The communication between these APIs and the Ecrion server is performed through REST endpoints via HTTP or HTTPS.
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 /doc URL. For a local installation using the default ports, this would be:
- For HTTP: http://localhost:50100/doc
- For HTTPS: https://localhost:50101/doc
The default ports can be updated from the Management Console tool, by going to the Engine Settings\HTTP Server Configuration and updating the HTTP Server Port parameter, respectively HTTPS Server Port.
Getting Started
Authentication
Ecrion uses API keys in order to authenticate requests made by clients. You have to access the Management Console to find the API Key in order to use the Ecrion Develop API.
For core-only installations, open the Management Console, and navigate to Ecrion Develop Engine/Engine Settings/HTTP Server Configuration/API KEY. 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.
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 Ecrion Develop Samples then access XML Samples. You can find here samples that prove the basic conversion capabilities of out Ecrion Develop tool: Ecrion Studio Publisher templates and XSL-FO files for XML to PDF conversion, and also DAL files use for document assembly.
Using Ecrion JavaScript API
Including the library
The Javascript API is referenced through Ecrion.EOS.Client.2.0.js. Use https://eos4.ecrion.com as the server name, however for core-only installations, make sure to use the correct server name and port number provided by your system administrator:
<html>
<head>
<script src="https://eos4.ecrion.com/sdk/v2/javascript/Ecrion.EOS.Client.2.0.js"></script>
</head>
<body>
<script>
// Javascript code that uses the Ecrion API
</script>
</body>
</html>
Using the API
The example below uses JavaScript to convert XML to PDF using a template stored on the Ecrion server. An XML string is sent to the Ecrion server and a PDF is received back:
// Wait for the API to initialize
eosAPI.ready(function(){
// Authenticate using an API key
eosAPI.authorize("API:59e80576-19e5-4808-98c0-cf2c9da055ea")
.catch(function(response){
// Handle any authentication errors here
alert("Authentication failure: " + response.statusText);
})
});
// Wait for authorize() to complete
eosAPI.authorized(function(){
// Render an xml to pdf using a template
eosAPI.DirectRender.Render({
request: {
InputSettings: {
Template: {
Workspace: "Default",
Path: "Retail/Bookstore Invoice/Invoice.epr"
}
},
Input: {
InputFormat: "xml",
Source: '<?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>'
},
PdfOutput: {}
}
}, {
responseContentType: 'application/pdf'
})
.then(function(response) {
// PDF rendered and received. You can use response.data to retrieve the PDF bytes,
// however for this sample the previewResponse utility is used
// to quickly preview the response bytes in a new window
eosAPI.Util.previewResponse(response);
})
.catch(function(response){
// Handle any render errors here
alert("Render error: " + response.obj.Message);
});
});
Notes
obj property contains the deserialized response. data property contains the response bytes if it's binary. status property contains the HTTP status code. .ready or .authorized wrappers..authorizeWithToken utility instead of authorize.eosAPI.sessionToken.Using Ecrion .NET API
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
In the zip file there is a README.html file that explains how to use 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 Ecrion API to convert XML to PDF using a template stored on the Ecrion server. An XML string is sent to the Ecrion server and a PDF is received back and downloaded locally.
string eosUrl = "https://eos4.ecrion.com";
string apiKey = "API:59e80576-19e5-4808-98c0-cf2c9da055ea";
string downloadFolder = "C:/Downloads/";
string fileName = "eos-sample1-xml2pdf.pdf";
try
{
AuthorizationService authSvc = new AuthorizationService(eosUrl);
string sessionToken = authSvc.GetToken(apiKey).AccessToken;
Console.WriteLine("Your token is: {0}", sessionToken);
// Render XML -> PDF
// Create a new Render API
DirectRenderService renderSvc = new DirectRenderService(eosUrl);
// Create a new render request
RenderRequestEntity request = new RenderRequestEntity()
{
InputSettings = new InputSettings()
{
Template = new Template()
{
Workspace = "Default",
Path = "Retail/Bookstore Invoice/Invoice.epr"
}
},
Input = new Input()
{
InputFormat = "xml",
Source = "<?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>"
},
PdfOutput = new PdfOutput()
};
// Send the request
Stream response = renderSvc.Render(sessionToken, request);
Console.WriteLine("XML -> PDF rendered ok");
// Download the PDF locally
if (!Directory.Exists(downloadFolder))
Directory.CreateDirectory(downloadFolder);
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 Ecrion Java API
Downloading the API
For core-only installations, use the SDK download page, which is by default 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
In the zip file there is a README.html file that explains how to use 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 Ecrion API to convert XML to PDF using a template stored on the Ecrion server. An XML string is sent to the Ecrion server and a PDF is received back:
String eosUrl = "https://eos4.ecrion.com";
String apiKey = "API:59e80576-19e5-4808-98c0-cf2c9da055ea";
String downloadFolder = "C:/Downloads/";
String fileName = "eos-sample1-xml2pdf.pdf";
AuthorizationService authSvc = new AuthorizationService(eosUrl);
String sessionToken = authSvc.getToken(apiKey).getAccessToken();
System.out.format("Your token is: %s%n", sessionToken);
// Create a new render request
RenderRequestEntity renderRequest = new RenderRequestEntity();
InputSettings inputSettings = new InputSettings();
Template template = new Template();
template.setWorkspace("Default");
template.setPath("Retail/Bookstore Invoice/Invoice.epr");
inputSettings.setTemplate(template);
renderRequest.setInputSettings(inputSettings);
Input input = new Input();
input.setInputFormat("xml");
input.setSource("<?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>");
renderRequest.setInput(input);
renderRequest.setPdfOutput(new PdfOutput());
DirectRenderService renderSvc = new DirectRenderService(eosUrl);
// Send the Request
java.io.InputStream response = renderSvc.render(sessionToken, renderRequest);
// Download the PDF locally
FileOutputStream outputFile = new FileOutputStream(downloadFolder + fileName);
byte[] buffer = new byte[1024];
int bytesRead = -1;
java.io.BufferedInputStream bufferedReader = new java.io.BufferedInputStream(response);
while ((bytesRead = bufferedReader.read(buffer, 0, 1024)) != -1)
outputFile.write(buffer, 0, bytesRead);
response.close();
outputFile.close();
System.out.format("File %s downloaded ok%n", downloadFolder + fileName);
Java SDK Notes
The API Reference documents entities and methods using a simplified model. You will need to use setters and getters when working with the entities, just like it's used in the above example.
General Notes
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
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 Enteprise 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 Enterprise Website base URI, e.g. api/v2/token refers to https://eos4.ecrion.com/api/v2/token.
Authorization
GetToken
Generates the access token used for all API calls. Ecrion Develop
GET /api/v2/token
To generate an access token, call this method and supply the user credentials (case sensitive). The preferred way of authenticating is to use an 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 <sessionTokenInbase64> format in order to authorize a generic endpoint.
If you're using our Javascript, .NET or Java client 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
Javascript
If you're running Javascript inside a browser, you should avoid typing the credentials in plain text because the .js sources are available to the client.
Instead, it is preferred to store the API Key on your server and do the authentication in a secure backend, passing only a sessionToken to the client, using authorizeWithToken utility.
eosAPI.ready(function(){
var sessionToken = obtainTokenFromMyBackend();
eosAPI.authorizeWithToken(sessionToken);
//all subsequent eosAPI calls will use the sessionToken
})
However, if you're using Javascript in a server-side environment or the credentials are provided by the client user, the authorize utility method is available.
Internally, it calls Auth.GetToken and uses the returned access token for all subsequent calls through the eosAPI global instance:
var apiKey = "API:dee401eb-d3e5-4523-9f90-c19a573e7e0a";
eosAPI.authorize(apiKey)
.catch(function(response){
// Handle any authentication errors here
alert("Authentication failure: " + err.statusText);
});
eosAPI.authorized(function(){
//all eosAPI calls will use the sessionToken obtained based on the apiKey
});
The authorize method supports passing two arguments, i.e. eosAPI.authorize(username, password) if you want to use a username/password combination.
If credentials are used on multiple environments, the environment name is required
For example → eosAPI.authorize(username, password, environment).
.NET
string apiKey = "API:dee401eb-d3e5-4523-9f90-c19a573e7e0a";
AuthorizationService authSvc = new AuthorizationService("https://eos4.ecrion.com/");
string sessionToken = authSvc.GetToken(apiKey).AccessToken;
Alternatively, it's possible to use a username/password combination to authenticate.
For example → authSvc.GetToken(username + ":" + password)
If credentials are used on multiple environments, the environment name is required to authenticate.
For example → authSvc.GetToken(environment + "#" + username + ":" + password)
Java
String apiKey = "API:dee401eb-d3e5-4523-9f90-c19a573e7e0a";
AuthorizationService authSvc = new AuthorizationService("https://eos4.ecrion.com/");
String sessionToken = authSvc.getToken(apiKey);
Alternatively, it's possible to use a username/password combination to authenticate:
For example → authSvc.getToken(username + ":" + password)
If credentials are used on multiple environments, the environment name is required to authenticate:
For example → authSvc.GetToken(environment + "#" + username + ":" + password)
HTTP
curl -X GET --header "Accept: application/json" --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/token"
Alternatively, it's possible to use a username/password combination to authenticate. Replace -u apiKey: with -u username:password
If credentials are used on multiple environments, the environment name is required to authenticate. Replace -u apiKey: with -u environment#username:password
Repository
Ecrion Repository stores all assets involved in document production (images, templates, stylesheets, etc.) in a file repository. The Ecrion core-only installation provides a basic level of functionality, while the complete installation comes with a high performance repository capable of sustaining 1000s of read/write operations per second, versioning and dependency tracking.
Methods:
Repository.DeleteFileRepository.GetFilesRepository.UpdateFileRepository.DownloadFileRepository.UploadFileRepository.DeleteFolderRepository.GetFoldersRepository.CreateFolderRepository.ExportFolderRepository.ImportFolder
Entities:
DownloadFile
Download a file from Ecrion Develop workspace. Ecrion Develop
GET /api/v2/files/content
Parameters
Authorization- Override the Authorization header value.workspace- Workspace name Requiredpath- File path Required
Returns
binary data- File bytes
Examples
Javascript
eosAPI.Repository.DownloadFile({
workspace: "Monthly Statement",
path: "/Monthly Statement"
})
.then(function(response) {
var content = response.data;
})
.NET
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
Stream content = repo.DownloadFile(token, "Monthly Statement", "/Monthly Statement");
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
java.io.InputStream content = repo.downloadFile(token, "Monthly Statement", "/Monthly Statement");
HTTP
curl -X GET --header "Accept: application/octet-stream" --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/files/content?workspace=Default&path=%5CBookstore%20Invoice%5CInvoice.dal"
__
UploadFile
Upload a local file to a Ecrion Develop Workspace. Ecrion Develop
POST /api/v2/files/content
Parameters
Authorization- Override the Authorization header value.workspace- Workspace name. Requiredpath- File path. Requiredfile- The file to upload. Required
Returns
Examples
Javascript
eosAPI.Repository.UploadFile({
workspace: "Monthly Statement",
path: "/Monthly Statement/Sample.xml",
file: new File(['<?xml version=\"1.0\" standalone=\"yes\"?><root></root>'], "Sample.xml", {type: "text/xml"})
})
.then(function(response) {
var file = response.obj;
});
.NET
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
using (FileStream fsSource = new FileStream(@"C:\Sample.xml", FileMode.Open, FileAccess.Read))
{
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
FileEntity fileResponse = repo.UploadFile(token, "Monthly Statement", "/Monthly Statement/Sample.xml", fsSource);
}
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
java.io.InputStream fsSource = new FileInputStream("C:\\Sample.xml");
repo.uploadFile(token, "Monthly Statement", "/Monthly Statement/Sample.xml", fsSource);
HTTP
curl -X POST -F "file=@C:\Temp\Invoice.epr" -u "TOKEN:7a6961b5-5be4-4318-b82e-4631659efa38" "http://localhost:50100/api/v2/files/content?workspace=Default&path=Bookstore%20Invoice/Invoice.epr"
__
GetFiles
Returns a list of files from the specified parent path and an workspace. Ecrion Develop
GET /api/v2/files
Parameters
Authorization- Override the Authorization header value.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
If the path is a file the result will contain a list of one file metadata from the specified file path.
Returns FileEntity[]
Path- Path to the fileWorkspace- The workspace name in which the file is locatedType- A friendly file type name (e.g."PDF File")Bytes- The file size in bytesCreatedDate- The date when the current version was created (see Date Format)
Examples
Javascript
// List all files in Bookstore Invoice folder
eosAPI.Repository.GetFiles({
workspace: "Monthly Statement",
path: "/Translatione"
})
.then(function(response) {
var files = response.obj;
})
.NET
// List all files in Bookstore Invoice folder
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
List<FileEntity> files = repo.GetFiles(token, "Monthly Statement", "/Translation");
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
java.util.List<FileEntity> files = repo.getFiles(token, "Monthly Statement", "/Translation", 0, 10);
HTTP
curl -X GET --header "Accept: application/json" --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/files?workspace=Default&path=%5CBookstore%20Invoice"
__
UpdateFile
Rename, copy or move a file Ecrion Develop
PUT /api/v2/files
Parameters
Authorization- Override the Authorization header value.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
Javascript
eosAPI.Repository.UpdateFile({
workspace: "Monthly Statement",
path: "\MonthlyStatement.epr",
fileOperation:{
path: "\MonthlyStatement2.epr",
action: "copy"
}
})
.then(function(response) {
var status = response.status;
});
.NET
//duplicate MonthlyStatement.epr as MonthlyStatement2.epr
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
repo.UpdateFile(token, "Monthly Statement", "/MonthlyStatement.epr",
new FileOperationEntity()
{
Path = "/MonthlyStatement2.epr",
Action = "copy"
});
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
FileOperationEntity op = new FileOperationEntity();
op.setPath("/MonthlyStatement2.epr");
op.setAction("copy");
op.setOverwrite(true);
repo.updateFile(token, "Monthly Statement", "/MonthlyStatement.epr", op);
HTTP
curl -X PUT --header "Content-Type: application/json" --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" -d "{
\"Path\": \"\Bookstore Invoice\Invoice000.dal\",
\"Action\": \"copy\",
\"Overwrite\": true
}" "http://localhost:50100/api/v2/files?workspace=Default&path=%5CBookstore%20Invoice%5CInvoice.dal"
__
DeleteFile
Delete a file from Ecrion repository. Ecrion Develop
DELETE /api/v2/files
Parameters
Authorization- Override the Authorization header value.workspace- Workspace name Requiredpath- The path of the file to be deleted Required
Returns
204 (No Content)- HTTP status code
Examples
Javascript
eosAPI.Repository.DeleteFile({
workspace: "Monthly Statement",
path: "\MonthlyStatement.epr",
})
.then(function(response) {
var status = response.status;
});
.NET
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
repo.DeleteFile(token, "Monthly Statement", "/Monthly Statement");
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
repo.deleteFile(token, "Monthly Statement", "\MonthlyStatement.epr");
HTTP
curl -X DELETE --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/files?workspace=Default&path=%5CBookstore%20Invoice%5CInvoice.epr"
__
ExportFolder
Download a zip file of a folder from Ecrion repository. Ecrion Develop
GET /api/v2/folders/content
Parameters
Authorization- Override the Authorization header value.workspace- Workspace name. Requiredpath- Path to the folder to be exported. Required
Returns
binary data- the zip file
Examples
Javascript
eosAPI.Repository.ExportFolder({
workspace: "Monthly Statement",
path: "/Translation"
})
.then(function(response) {
// zip is a blob
var zip = response.data;
});
.NET
// Export Bookstore Invoice folder
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
Stream zip = repo.ExportFolder(token, "Monthly Statement", "/Translation");
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
java.io.InputStream zip = repo.exportFolder(token, "Monthly Statement", "/Translation");
HTTP
curl -X GET --header "Accept: application/octet-stream" --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/folders/content?workspace=Default&path=%5CBookstore%20Invoice"
__
ImportFolder
Decompress an archive and uploads its content to Ecrion repository. Ecrion Develop
POST /api/v2/folders/content
Parameters
Authorization- Override the Authorization header value.workspace- Workspace name. Requiredpath- Folder path. Requiredfile- Zip file bytes. Required
Returns
Examples
Javascript
//Upload generated .zip file
eosAPI.Repository.ImportFolder({
workspace: "Monthly Statement",
path: "/Translation",
file: new File([/*content*/ ], "myFolder.zip")
})
.then(function(response) {
var folder = response.obj;
})
.NET
// Import 'myFolder' to Bookstore Invoice folder
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
using (FileStream fsSource = new FileStream(@"C:\myFolder.zip", FileMode.Open, FileAccess.Read))
{
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
FolderEntity folder = repo.ImportFolder(token, "Monthly Statement", "/Translation", false, fsSource);
}
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
java.io.InputStream fsSource = new FileInputStream("C:\\myFolder.zip");
repo.importFolder(token, "Monthly Statement", "/Translation", false, fsSource);
HTTP
curl -u "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80:" -F filedata=@"C:\myFolder.zip" "http://localhost:50100/api/v2/folders/content?workspace=Default&path=%5CBookstore%20Invoice%5CTest"
__
CreateFolder
Create new folder Ecrion Develop
POST /api/v2/folders
Parameters
Authorization- Override the Authorization header value.workspace- Workspace name. Requiredpath- The path of the folder to be created. Required
Returns 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
Javascript
eosAPI.Repository.CreateFolder({
workspace: "Monthly Statement",
path: "NewFolder"
})
.then(function(response) {
var folder = response.obj;
})
.NET
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
FolderEntity folder = repo.CreateFolder(token, "Monthly Statement", "NewFolder");
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
FolderEntity folder = repo.createFolder(token, "Monthly Statement", "NewFolder");
HTTP
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/folders?workspace=Default&path=%5CBookstore%20Invoice%5CTest"
Request URL
__
GetFolders
Returns a list of folders in the specified parent path and workspace. Ecrion Develop
GET /api/v2/folders
Parameters
Authorization- Override the Authorization header value.workspace- Workspace name. Requiredpath- Folder path. Requiredstart- Start indexcount- Number of results
Returns
FolderEntity[]- A list ofFolderEntity
Examples
Javascript
// List all folders from a workspace
eosAPI.Repository.GetFolders({
workspace: "Monthly Statement",
path: "/Translation"
})
.then(function(response) {
var folders = response.obj;
})
.NET
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
List<FolderEntity> folders = repo.GetFolders(token, "Monthly Statement", "/Translation");
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
java.util.List<FolderEntity> folders = repo.getFolders(token, "Monthly Statement", "/Translation", 0, 10);
HTTP
curl -X GET --header "Accept: application/json" --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/folders?workspace=Default&path=%5CBookstore%20Invoice"
__
DeleteFolder
Deletes the folder. Ecrion Develop
DELETE /api/v2/folders
Parameters
Authorization- Override the Authorization header value.workspace- Workspace name. Requiredpath- Folder path. Required
Returns
204 (No Content)- HTTP status code
Examples
Javascript
eosAPI.Repository.DeleteFolder({
workspace: "Monthly Statement",
path: "/Translation"
})
.then(function(response) {
var status = response.status;
})
.NET
string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
repo.DeleteFolder(token, "Monthly Statement", "/Translation");
Java
String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
repo.deleteFolder(token, "Monthly Statement", "/Translation");
HTTP
curl -X DELETE --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/folders?workspace=Default&path=%5CBookstore%20Invoice%5CInput"
DirectRender
Render
Render input into a variety of output formats including PDF, Word, etc. Ecrion Develop
POST /api/v2/render
Parameters
Authorizationrequestof typeRenderRequestEntityInput- You can specify either aSourceor a combination of anWorkspaceandPath. RequiredInputFormat- Format of the source document- Allowed Values:
pdf,xslfo,svg,xml,wordml,docx,html,eps,dal,das,xfd,excel,json
- Allowed Values:
Source- String representing the source document. Use BASE64 encoding if the source document is binary.Workspace- The workspace namePath- The file path
InputSettingsReferenceResolver- 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- 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.ImageErrors- 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:
Template
TemplateWorkspace- The workspace namePath- The file pathLanguageId- Language idXSLTEngine- 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 Java
TemplateParameters- A key-value mapping that sets template parameters.Name- Template parameter nameValue- Template parameter value
HtmlInput- HTML input settingsEncoding- Specifies the character encoding of the input HTML document- Allowed Values:
utf8,win1252
- Allowed Values:
PageWidth- Specifies the page width as a length value or automatic.- Default:
auto
- Default:
PageHeight- Specifies the page height as a length value or automatic.- Default:
auto
- Default:
PageMarginTop- Specifies the page top margin as a length value.- Default:
1in
- Default:
PageMarginLeft- Specifies the page left margin as a length value.- Default:
1in
- Default:
PageMarginRight- Specifies the page right margin as a length value.- Default:
1in
- Default:
PageMarginBottom- Specifies the page bottom margin as a length value.- Default:
1in
- Default:
PageHeaderMargin- Specifies the page header margin as a length value.- Default:
0.5in
- Default:
PageFooterMargin- Specifies the page footer margin as a length value.- Default:
0.5in
- Default:
ShowPageNumber- Specifies whether to render page numbers in the output.ShowTitle- Specifies whether to render page title in the output.
PdfOutput- Default output if none specified. Available inEcrion DevelopPrefixFontSubset- Specifies whether to add prefixes to the names of subsetted fonts in the internal structure of the output PDF.EmbedTTF- Specifies whether to embed TrueType fonts.HideToolbar- Specifies whether to hide the PDF viewer menubar.HideMenubar- Specifies whether to hide the PDF viewer menubar.HideWindowUI- Specifies whether to hide the PDF viewer window UI.FitWindow- Specifies whether the output PDF should fit the window when opened.CenterWindow- Specifies whether the output PDF should center in the window when opened.DisplayDocTitle- Specifies whether to display the title of the output PDF.Conformance- Specifies the level of PDF conformance.- Allowed Values:
none,pdfx,pdfa-1a,pdfa-1a-accesible,pdfa-1b,pdf508
- Allowed Values:
Version- Specifies the PDF version.- Allowed Values:
pdf16,pdf14,pdf15,pdf17 - Default:
pdf16
- Allowed Values:
AllowPrinting- If owner-password is set, this can be set to allow printing.AllowModifyContents- If owner-password is set, this can be set to allow editing.AllowCopy- If owner-password is set, this can be set to allow copying.AllowModifyAnnotations- If owner-password is set, this can be set to allow manipulating annotations.AllowFillIn- If owner-password is set, this can be set to allow filling in forms.AllowScreenReaders- If owner-password is set, this can be set to allow screen readers.AllowAssembly- If owner-password is set, this can be set to allow document assembly.AllowDegradedPrinting- If owner-password is set, this can be set to allow degraded printing.ImageCompression- Specifies the type of image compression.- Allowed Values:
jpeg,flat - Default:
jpeg
- Allowed Values:
OwnerPassword- 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- 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.EncryptionsStrength- If a password is set, specifies the strength with which to encrypt the document.- Allowed Values:
48,128 - Default:
48
- Allowed Values:
-
HtmlOutputAvailable inEcrion DevelopHideStaticContent- Skip rendering of static content elements (headers, footers, etc.) in HTML output.GenerateHtmlDocument- Specifies whether to wrap the generated HTML content to form a full HTML document, i.e. html, head, and body tags.UseFixedBodyWidth- Specifies whether to use a fixed width to approximate a paginated document layout or a fluid layout based on the window size.RenderedImagesBaseUrl- 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- Specifies whether to render BI widgets as interactive or static.RenderedImagesOutputFolder- Specifies the output folder for the rendered images.
*Notes
HTML output in Ecrion Develop can be used to generate content for web browsers (Firefox, Safari, Chrome, Edge, etc.) However, it is not suitable to be sent via email.
TxtOutputAvailable inEcrion DevelopEncoding- Specifies the output file encoding.- Allowed Values:
utf-8,utf-16,ascii - Default:
ascii
- Allowed Values:
FormFeed- Specifies whether to separate pages using the form feed character.IgnoreCssBoxAttributes- 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- Specifies whether to trim whitespace off pages.LineHeight- Specifies the value in points to assume as the output's line height.- Default:
1.4
- Default:
FontSize- Specifies the value in points to assume as the output's font size.- Default:
9
- Default:
FontFamily- Specifies the font family to assume will be used in the output.- Default:
Courier New
- Default:
Returns
binary data- the output document, in a format determined by the request output settings.
Examples
Javascript
eosAPI.DirectRender.Render({
request: {
InputSettings: {
Template: {
Workspace: "Default",
Path: "Retail/Bookstore Invoice/Invoice.epr"
}
},
Input: {
InputFormat: "xml",
Source: "<?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>"
},
TxtOutput: {}
}
})
.then(function(response) {
var content = response.data;
})
.NET
DirectRenderService renderSvc = new DirectRenderService("https://eos4.ecrion.com/");
// Create a new request
RenderRequestEntity request = new RenderRequestEntity();
request.InputSettings = new InputSettings();
request.InputSettings.Template = new Template();
request.InputSettings.Template.Workspace = "Default";
request.InputSettings.Template.Path = "Retail/Bookstore Invoice/Invoice.epr";
request.Input = new Input();
request.Input.InputFormat = "xml";
request.Input.Source = "<?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>";
request.TxtOutput = new TxtOutput();
// Send the request
Stream content = renderSvc.Render(sessionToken, request);
Java
DirectRenderService renderSvc = new DirectRenderService("https://eos4.ecrion.com/");
// Create a new request
RenderRequestEntity request = new RenderRequestEntity();
InputSettings inputSettings = new InputSettings();
Template template = new Template();
template.setWorkspace("Default");
template.setPath("Retail/Bookstore Invoice/Invoice.epr");
inputSettings.setTemplate(template);
request.setInputSettings(inputSettings);
Input input = new Input();
input.setInputFormat("xml");
input.setSource("<?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>");
request.setInput(input);
request.setTxtOutput(new TxtOutput());
// Send the request
java.io.InputStream response = renderSvc.render(sessionToken, request);
HTTP
curl -H "Content-Type: application/json" -X POST -u "TOKEN:7a6961b5-5be4-4318-b82e-4631659efa38" -d "{ 'Input' : { 'Source' : '<?xml version=\"1.0\" standalone=\"yes\"?><root></root>' }, 'InputSettings' : { 'Template' : { 'Workspace' : 'Default', 'Path' : 'Retail/Bookstore Invoice/Invoice.epr' } }, 'TxtOutput' : {}}" "http://localhost:50100/api/v2/render"
DirectData
Data
Process a data model diagram and return the output data as a stream. Ecrion Develop
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 .edd, then the output will be a Database Output file.
Examples
Javascript
eosAPI.DirectData.Data({
request: {
InputSettings: {
Diagram: {
Workspace: "Default",
Path: "Retail/Bookstore Invoice/Invoice.edx"
}
}
}
})
.then(function(response) {
var content = response.data;
})
.NET
DirectDataService dataSvc = new DirectDataService("https://eos4.ecrion.com/");
// Create a new request
DataRequestEntity request = new DataRequestEntity();
request.InputSettings = new DataInputSettings();
request.InputSettings.Diagram = new Diagram();
request.InputSettings.Diagram.Workspace = "Default";
request.InputSettings.Diagram.Path = "Retail/Bookstore Invoice/Invoice.edx";
// Send the request
Stream content = dataSvc.Data(sessionToken, request);
Java
DirectDataService dataSvc = new DirectDataService("https://eos4.ecrion.com/");
// Create a new request
DataRequestEntity request = new DataRequestEntity();
DataInputSettings inputSettings = new DataInputSettings ();
Diagram diagram = new Diagram ();
diagram.setWorkspace("Default");
diagram.setPath("Retail/Bookstore Invoice/Invoice.edx");
inputSettings.setTemplate(template);
request.setInputSettings(inputSettings);
// Send the request
java.io.InputStream response = dataSvc.data(sessionToken, request);
HTTP
curl -H "Content-Type: application/json" -X POST -d "{ 'InputSettings' : { 'Diagram' : { 'Workspace' : 'Default', 'Path' : 'Retail/Bookstore Invoice/Invoice.edx' } }" -u "TOKEN:83b02efa-9253-413e-896b-d1011e5127fc" "http://localhost:50100/api/v2/data"
Status
GetStatus
Get information about the server: Name, Version, Build number and Status. Ecrion Develop
GET /api/v2/status
Returns StatusEntity[]
ProductName- Name of the installed solutionProductVersion- The current version of the installed solutionBuildNumber- The build number of the current versionStatusCode- The code of the server statusStatus Description- The description of the server status
Examples
Javascript
eosAPI.Server.GetStatus({
url: "http://eos4.ecrion.com",
})
.then(function(response) {
var content = response.data;
})
.NET
ServerService server = new ServerService("https://eos4.ecrion.com/");
StatusEntity statusResponse = server.getStatus();
Java
ServerService server = new ServerService("https://eos4.ecrion.com/");
java.util.List<StatusEntity> statuses = server.getStatus();
HTTP
curl -X GET --header "Accept: application/json" --header "Authorization: Basic MGFlNGFmNDEtYjUzMC00MDM4LWJlODItYTBmYThiM2YxZDU1" "http://localhost:50100/api/v2/status"