1. JSON - Hello World
The REST JSON API is a comprehensive collection of programming API that can be used to remotely manage your media database. There are currently over 90 separate API used to create, search, update and delete from any database table within EnterMedia.
To get started with calling the API you will need to have a valid login. EnterMedia MediaDB App provides with documentation for built-in API calls. To enter the MediaDB App go to https://entermediadb.org/entermediadb/mediadb/index.html replace entermediadb.org and entermediadb with your respective domain and catalog.
The user should have required permissions to use the API. Go to the Permissions and select the Users Role, scroll down to the Programming API view and turn on all the available permissions or just read-only options.
The first API you will need to call will load up the entermedia.key cookie into the clients HTTP session that does not expire. This will allow auto login for subsequent API requests so that you will not need to worry about being disconnected and having to login again. As long as the entermedia.key cookie is saved the client with log in automatically.
Calling The API
Example curl command to run the Hello Word using the previously generated token, not that if you're using an SSL layer, you'll need to pass the -L parameter to your curl command in order to have it following the redirection to port 443:
curl -H "Content-Type: application/json" -X POST http://em9dev.entermediadb.org/assets/mediadb/services/test/helloworld -b 'entermedia.key=adminmd5421c0af185908a6c0c40d50fd5e3f16760d5580bc'
Each time you create a new module the system will automatically define the end points and add that module CRUD operations to the MediaDB API. To reload existing modules you may need to click on the "Load Modules" link at the top left side of the MediaDB tool. This only has to be done once after upgrading EnterMedia.
Creating your custom API
A trained EnterMedia developer can create their own Custom API can be added to the list of API.
- Creating your own configurations such as /mediadb/services/mystuff/hello.xconf file
- Define the path-action that will be called. To define your own objects copy this file: /WEB-INF/base/mediadb/src/plugin.xml to /WEB-INF/base/mystuffapp/src/plugin.xml
- Restart the tomcat web server since mediadb objects are cached.
- Use the DataManager to add your API to the database tables called docsection and endpoint