imScript Manual

API samples

« Back  |  Next »
General information
Text field
Image field
Page information
Links & Menu
Data tags
User data
Date tags
API samples
imScript tags list
RSS feed
imCMS comes with an API for usage in servlets and jsp-pages, see the javadocs.
Also, linked from this document are differens examples on how to use the api. Follow the links below.


Example pages


The following links works differently depending on the user's permissions on the corresponding admin-pages. That is, what user you are logged in as, and what administrative permissions that user has.
That means that even though you don't specify a user in most of the API:s method, usually the current logged in user is passed as an invisible parameter.

Exeption handling in jsp-pages

If the user that is accessing the page doesn't have the right permissions a NoPermissionException is thrown from the methods. There are two normal ways to handle this.
1. In the jsp pages page-tag set the errorpage attribute and let that page handle the response to the user
2. Use try/catch in a normal Java way.
In this sample page, the first choice is made; see execute error.jsp, view source files for details.

Who you are

To see what user you are logged in as, execute logged_in_user.jsp, view source

First, make sure that you are logged in typing '/login' after your imCMS disctibution URL in your browser. Log out (and become a non-logged in user) typing '/servlet/LogOut' after your imCMS disctibution URL in your browser. 



To create a user, execute user_create_user.jsp, view source
To see what users that exists in the system, execute user_listing.jsp, view source
To get attributes for one user by login name or by user id, execute user_get_user.jsp, view source


List all roles, execute role_list_all.jsp, view source
Add, execute role_create_role.jsp, view source
Delete, execute role_delete_role.jsp, view source
Rename, execute role_edit_role.jsp, view source

List users with different roles, execute role_get_user_with_role.jsp, view source


The following samples modify document 1001.
It currently looks like this, servlet/GetDoc?meta_id=1001

Get the information about the document, execute document_get_document_info.jsp, view source
Change the document information, execute document_change_document_info.jsp, view source

Show template for a document, execute document_show_templates.jsp, view source
Change template for a document, execute document_change_template.jsp, view source
Set template for a document to "Start", execute document_change_template_by_name.jsp, view source
Set template for a document to one with id=1, execute document_change_template_by_id.jsp, view source
List all possible templates and template groups, execute templates_show_all.jsp, view source

Get the first text field from the document, execute document_get_texts_from_fields.jsp, view source
Change the first and the second field, execute document_set_text_field.jsp, view source
Clear the first and the second field, execute document_clear_text_field.jsp, view source

Get image no 2 from the document, execute document_get_images.jsp, view source
Set image no 2 in the document, use one image from the image folder, execute document_set_image.jsp, view source

Get the first menu from the document, execute document_get_menu.jsp, view source
Add a document to a menu, execute document_add_to_menu.jsp, view source
Remove a document from a menu, execute document_remove_from_menu.jsp, view source
Set the sort order of all menus in a document, execute document_set_sortorder.jsp, view source

Get the first include from the document, execute document_get_includes.jsp, view source
Change the first include, execute document_set_include.jsp, view source
Clear the first include, execute document_clear_include.jsp, view source

To create different kinds of document that is linked from the document above, execute document_create_documents.jsp, view source

To list files in file-documents, execute file_document_search.jsp, view source


List all possible document categories, execute categories_show_all.jsp, view source
Create a new category type and a category, execute category_create.jsp, view source
Change the name of a category, execute category_edit.jsp, view source

Searching for documents

Searching for documents, execute document_search.jsp, view source

Documents and permissions

You can manipulate documents in various ways. To do so the current user has to have specific roles, that in turn has to have specific rights. execute document_permissions.jsp, view source
Set the permissions for a role on a document, execute document_set_permissions.jsp, view source

There are two different levels of configurable "restricted" permissions that can be modified. To see what specified "Restricted One" permissions a page has, see execute document_permission_show_restricted_1.jsp, view source

Sending mail

To send a file-document as attachments in a mail, execute mail_send_file_document.jsp, view source

Database connection

Get access to the database, execute database_get_connection.jsp, view source

[Help for the whole system | imScript manual | All documentation]

Suggestions or comments? Please send us a mail: