API Creation by cURL

You can script the import process using cURL, which creates an API project. You can extend the following example to automate the setting of the database properties and and the authentication provider after import. You can also export the project from the command line using a GET with a filter.

Obtain the Auth Token

The admin project requires an auth token. Use the same username and password that you use to log in to the API Creator. The URL you use depends on your setup. In this example, we use the Jetty eval server. Change that if you use your own server.

Note: The URI might be https. You can find the URI using the REST Lab.

Issue the following command:

curl -H "Content-Type: application/json" -d '{"username": "admin", "password": "Password1"}' -X POST http://localhost:8080/rest/abl/admin/v2/@authentication

The following response is expected:

  "apikey": "e315ecb50cae07c799cfdc7a2567db4e",
  "expiration": "2016-01-05",
  "lastLoginTs": "2016-01-06",
  "lastLoginIP": "123.321.12.21"

The response includes the auth token, in bold.

Import the Project


  • You have an exported JSON file. For demonstration purposes, the following code snippet uses the example myExport.json JSON file as the previously exported file.
  • You have obtained the auth token.

Import your previously exported file as a new project use the following command, including the auth token and the JSON file name:

curl -H "Authorization: CALiveAPICreator e315ecb50cae07c799cfdc7a2567db4e:1" -H "Content-type: application/json" --data-binary @myExport.json -X POST http://localhost:8080/rest/abl/admin/v2/ProjectExport

POST is made to the ProjectExport resource.