Docs‎ > ‎Logic Designer‎ > ‎Project‎ > ‎

Importing a project

Espresso provides alternatives for importing a project:
  • You can use the Logic Designer, as illustrated here for the Logic Sample Project
  • You can use the Command Line.
This page explains how to import a project using the Command Line.  

This could be used to automate a deployment from source control to a production system.  The example below can easily be extended to automate the setting of the database properties and and the authentication provider after import.  The project can also be exported from the command line using a GET with a filter.

1 - Get an API key

You'll need an API key for the admin project. You'll use the same username and password that you use to log into the Logic Designer. The URL will depend on your setup -- here we use the eval server, you'll need to change that if you use your own server.

curl -H "Content-Type: application/json" -d '{"username": "acme", "password": "secret"}' -X POST https://eval.espressologic.com/rest/abl/admin/v2/@authentication

Response:

{
  "apikey": "2bcf59debb828967423ffdd7e72b39e0",
  "expiration": "2014-07-15",
  "lastLoginTs": "2014-07-14",
  "lastLoginIP": "165.223.43.19"
}


2 - Get your account ID

Using the newly obtained API key:

curl -H "Authorization: Espresso 2bcf59debb828967423ffdd7e72b39e0:1" -X GET https://eval.espressologic.com/rest/abl/admin/v2/accounts

Note the addition of ":1" at the end of the API key.
The result should be an array containing a single object:

[
  {
    "@metadata": {
      "href": "https://eval.espressologic.com/rest/abl/admin/v2/accounts/1234",
      "checksum": "A:1d80d941075b322d",
      "links": [
        {
          "href": "https://eval.espressologic.com/rest/abl/admin/v2/authproviders?filter=account_ident%20%3D%201234",
          "rel": "children",
          "role": "authprovidersList",
          "type": "https://eval.espressologic.com/rest/abl/admin/authproviders"
        },
        {
          "href": "https://eval.espressologic.com/rest/abl/admin/v2/accountoptions?filter=account_ident%20%3D%201234",
          "rel": "children",
          "role": "accountoptionsList",
          "type": "https://eval.espressologic.com/rest/abl/admin/accountoptions"
        },
        {
          "href": "https://eval.espressologic.com/rest/abl/admin/v2/logic_libraries?filter=account_ident%20%3D%201234",
          "rel": "children",
          "role": "logic_librariesList",
          "type": "https://eval.espressologic.com/rest/abl/admin/logic_libraries"
        },
        {
          "href": "https://eval.espressologic.com/rest/abl/admin/v2/projects?filter=account_ident%20%3D%201234",
          "rel": "children",
          "role": "projectsList",
          "type": "https://eval.espressologic.com/rest/abl/admin/projects"
        }
      ]
    },
    "ident": 1234,
    "ts": "2014-07-14T12:21:51.000+0000",
    "name": "Acme account",
    "url_name": "acme",
    "status": "A",
    "public_key": null,
    "private_key": null
  }
]

In this example, the account ID is 1234.

3 - Import the project

Given a JSON file myProject.json exported at a prior time, you can load it as a new project using the following command:

curl -H "Authorization: Espresso 2bcf59debb828967423ffdd7e72b39e0:1" -H "Content-type: application/json" --data-binary @myProject.json -X POST https://eval.espressologic.com/rest/abl/admin/v2/ProjectExport?account=1234

The output will be fairly voluminous.

Comments