Ecrion 12.0 Develop API Guide

This documentation describes the Application Programming Interfaces (API v2) for Ecrion Platform version 12.0 (Nido) 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.

The following features are matching the Ecrion Develop solution:

Ecrion provides the following APIs:

The communication between these APIs and the Ecrion server is performed through REST endpoints via HTTP or HTTPS.

Notes

  • For Ecrion Develop (core-only) installations, the default ports are 50100 (HTTP) and 50101 (HTTPS).
  • In the cloud however, only 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:

    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

    Ecrion comes with a feature REST API written in JavaScript that allows you to accomplish essentially anything that can be done through the user interface.

    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

  • The Ecrion JavaScript API uses Promises.
  • The response's obj property contains the deserialized response.
  • The response's data property contains the response bytes if it's binary.
  • The response's status property contains the HTTP status code.
  • Before using the API you must wait for it to become ready either by using .ready or .authorized wrappers.
  • If you're getting the sessionToken using your own backend you can use .authorizeWithToken utility instead of authorize.
  • After authorization is complete, the session token is available via eosAPI.sessionToken.
  • Using Ecrion .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

    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

    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://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);
    

    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. Ecrion 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 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

    In order to make calls to our REST methods, you will need to provide a token authenticating your current user. This call uses a basic authentication with your username and password for generating an authorization key that is your 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 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

    Returns TokenEntity

    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 QVBJOjBhZTRhZjQxLWI1MzAtNDAzOC1iZTgyLWEwZmE4YjNmMWQ1NQ==" "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.

    Methods:

    Entities:

    DownloadFile

    Download a file from Ecrion repository.

    GET /api/v2/files/content

    Parameters

    Returns

    Examples

    JavaScript

    eosAPI.Repository.DownloadFile({
        workspace: "Default",
        path: "Retail/Bookstore Invoice/Main.wk4"
    })
    .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, "Default", "Retail/Bookstore Invoice/Main.wk4");
    

    Java

    String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
    RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
    java.io.InputStream content = repo.downloadFile(token, "Default", "Retail/Bookstore Invoice/Main.wk4");
    

    HTTP

    curl -u "TOKEN:7a6961b5-5be4-4318-b82e-4631659efa38" "https://eos4.ecrion.com/api/v2/files/content?workspace=Default&path=Retail/Bookstore%20Invoice/Main.wk4"
    

    __

    UploadFile

    Upload a file to Ecrion repository.

    POST /api/v2/files/content

    Parameters

    Returns

    Examples

    JavaScript

    eosAPI.Repository.UploadFile({
        workspace: "Default",
        path: "Retail/Bookstore Invoice/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, "Default", "Retail/Bookstore Invoice/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, "Default", "Retail/Bookstore Invoice/Sample.xml", fsSource);
    

    HTTP

    curl -X POST -F "file=@C:\Sample.xml" -u "TOKEN:7a6961b5-5be4-4318-b82e-4631659efa38" "https://eos4.ecrion.com/api/v2/files/content?workspace=Default&path=Retail/Bookstore%20Invoice/Sample.xml"
    

    __

    GetFiles

    Returns a list of files from the Ecrion repository.

    GET /api/v2/files

    Parameters

    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

    Examples

    JavaScript

    // List all files in Bookstore Invoice folder
    eosAPI.Repository.GetFiles({
        workspace: "Default",
        path: "Retail/Bookstore Invoice"
    })
    .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, "Default", "Retail/Bookstore Invoice");
    

    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, "Default", "Retail/Bookstore Invoice", null, 0, 10, null, null);
    

    HTTP

    curl -u "TOKEN:7a6961b5-5be4-4318-b82e-4631659efa38" "https://eos4.ecrion.com/api/v2/files?workspace=Default&path=Retail/Bookstore%20Invoice"
    

    __

    UpdateFile

    Rename, copy or move a file.

    PUT /api/v2/files

    Parameters

    Returns

    Examples

    JavaScript

    eosAPI.Repository.UpdateFile({
        workspace: "Default",
        path: "/Design/Invoice/Invoice.epr",
        fileOperation:{
            path: "/Design/Invoice/Invoice2.epr",
            action: "copy"
        }
    })
    .then(function(response) {
        var status = response.status;
    });
    

    .NET

    //duplicate Invoice.epr as Invoice2.epr
    string token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
    RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
    repo.UpdateFile(token, "Default", "Retail/Bookstore Invoice/Invoice.epr",
        new FileOperationEntity()
        {
            Path = "Retail/Bookstore Invoice/Invoice2.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("Retail/Bookstore Invoice/Invoice2.epr");
    op.setAction("copy");
    op.setOverwrite(true);
    repo.updateFile(token, "Default", "Retail/Bookstore Invoice/Invoice.epr", op);
    

    HTTP

    curl -H "Content-Type: application/json" -X PUT -d "{ 'Path':'Retail/Bookstore Invoice/Invoice2.epr', Action:'copy' }" -u "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80:" "https://eos4.ecrion.com/api/v2/files?workspace=Default&path=Retail/Bookstore%20Invoice/Invoice.epr"
    

    __

    DeleteFile

    Delete a file from Ecrion repository.

    DELETE /api/v2/files

    Parameters

    Returns

    Examples

    JavaScript

    
    eosAPI.Repository.DeleteFile({
        workspace: "Default",
        path: "Retail/Bookstore Invoice/Main.wk4",
    })
    .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, "Default", "Retail/Bookstore Invoice/Main.wk4");
    

    Java

    String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
    RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
    repo.deleteFile(token, "Default", "Retail/Bookstore Invoice/Main.wk4");
    

    HTTP

    curl -X DELETE -u "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80:" "https://eos4.ecrion.com/api/v2/files?workspace=Default&path=Retail/Bookstore%20Invoice/Main.wk4"
    

    __

    ExportFolder

    Download a zip file of a folder from Ecrion repository.

    GET /api/v2/folders/content

    Parameters

    Returns

    Examples

    JavaScript

    eosAPI.Repository.ExportFolder({
        workspace: "Default",
        path: "Retail/Bookstore Invoice"
    })
    .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, "Default", "Retail/Bookstore Invoice");
    

    Java

    String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
    RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
    java.io.InputStream zip  = repo.exportFolder(token, "Default", "Retail/Bookstore Invoice");
    

    HTTP

    curl -u "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80:" "https://eos4.ecrion.com/api/v2/folders/content?workspace=Default&path=Retail/Bookstore%20Invoice"
    

    __

    ImportFolder

    Decompress an archive and uploads its content to Ecrion repository.

    POST /api/v2/folders/content

    Parameters

    Returns

    Examples

    JavaScript

    //Upload generated .zip file
    eosAPI.Repository.ImportFolder({
        workspace: "Default",
        path: "Retail/Bookstore Invoice",
        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, "Default", "Retail/Bookstore Invoice", 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, "Default", "Retail/Bookstore Invoice", false, fsSource);
    

    HTTP

    curl -u "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80:" -F filedata=@"C:\myFolder.zip" "http://eos4.ecrion.com/api/v2/folders/content?workspace=Default&path=Retail/Bookstore%20Invoice"
    

    __

    CreateFolder

    Create a new folder.

    POST /api/v2/folders

    Parameters

    Returns FolderEntity

    Examples

    JavaScript

    eosAPI.Repository.CreateFolder({
        workspace: "Default",
        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, "Default", "NewFolder");
    

    Java

    String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
    RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
    FolderEntity folder = repo.createFolder(token, "Default", "NewFolder");
    

    HTTP

    curl -X POST -d "{'path' : 'NewFolder'}" -u "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80" "https://eos4.ecrion.com/api/v2/folders?workspace=Default&path=NewFolder"
    

    __

    GetFolders

    Returns a list of folders in the specified parent path and workspace.

    GET /api/v2/folders

    Parameters

    Returns

    Examples

    JavaScript

    // List all folders from a workspace
    eosAPI.Repository.GetFolders({
        workspace: "Default",
        path: "Retail/Bookstore Invoice"
    })
    .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, "Default", "Retail/Bookstore Invoice");
    

    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, "Default", "Retail/Bookstore Invoice", 0, 10);
    

    HTTP

    curl -u "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80" "https://eos4.ecrion.com/api/v2/folders?workspace=Default&path=Retail/Bookstore%20Invoice"
    

    __

    DeleteFolder

    Delete an existing folder.

    DELETE /api/v2/folders

    Parameters

    Returns

    Examples

    JavaScript

    eosAPI.Repository.DeleteFolder({
        workspace: "Default",
        path: "Retail/Bookstore Invoice"
    })
    .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, "Default", "Retail/Bookstore Invoice");
    

    Java

    String token = "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80";
    RepositoryService repo = new RepositoryService("https://eos4.ecrion.com/");
    repo.deleteFolder(token, "Default", "Retail/Bookstore Invoice");
    

    HTTP

    curl -X DELETE -u "TOKEN:c87ca566-2587-4480-8a7a-27531f04af80" "https://eos4.ecrion.com/api/v2/folders?workspace=Default&path=Retail/Bookstore%20Invoice"
    

    DirectRender

    The 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

    Parameters

    Returns

    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

    The Direct Data API call uses diagrams as inputs, built in Modeler and ingest data, for example, directly as batches.

    Data

    Process a data model diagram and return the output data as a stream.

    POST /api/v2/data

    Parameters

    Returns

    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

    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" "https://eos4.ecrion.com/api/v2/data"
    

    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

    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"