Getting Started with MicroStrategy TaskProc

The MicroStrategy Task Processor is a light weight interface for performing basic events over the web.  It’s an easier API to interface with than Web Services, but doesn’t come with all of the features.  If you just need a quick administrative task or just need the results of a basic report, it can be easier to get off the ground than Web Services or Java Web SDK.  Today I’ll do a quick walkthrough on how to use this (free!) method of MicroStrategy custom interaction.

The Task Processor (“TaskProc”) is a free component with the MicroStrategy Web installation that doesn’t require any additional licensing to use.  To use it, you simply invoke the URL and consume the result either in your program or manually if you need to.

Accessing the Task Processor
For MicroStrategy 9.0.1 and prior, you can access the TaskProc using the following URLs:

ASPx: http://servername/MicroStrategy/asp/taskproc.aspx
JSP: http://servername:port/MicroStrategy/servlet/taskProc

For MicroStrategy 9.0.2+, they changed the URL slightly:

ASPx: http://servername/MicroStrategy/asp/taskadmin.aspx
JSP: http://servername:port/MicroStrategy/servlet/taskAdmin

Getting a Session
The first thing to do no matter what task you want to perform is to get a session.  Just like when you connect with Web or Desktop, you need to first connect to the server before issuing commands.
When you navigate to the TaskProc, you can go to the Builder tab and use a simple GUI to generate the URL you’ll need to invoke.  In this case, you’ll want to choose getSessionState from the first drop down, and then your choice of envelope and content type (I usually go with xml).
Fill out the minimum information of server, project, user and password, and be sure to check the box next to each to include it.
Scroll to the bottom of the page, and click the Update URL button to receive your URL in the text box below.
Example:

http://servername/MicroStrategy/asp/TaskAdmin.aspx?taskId=getSessionState&taskEnv=xml&taskContentType=xml&server=ISERVER&project=PROJECT+NAME&uid=USER+ID&pwd=PASSWORD 

If you go to that URL with your web browser, you’ll see the XML return with your session information. the first piece returned under the <min-state> node is your Session ID.
Executing Your Task
Once you have your session, you can now execute your task.  In this example, I’ll run a report since that’s pretty simple and probably a popular task to run.  For a list of options, just peruse the Task drop down list.
  1. Paste the sessionState that was received from the previous TaskProc step (from the <min-state> node).
  2. Use the style ReportGridStyle (trust me) and provide the Report GUID you want to execute.
  3. Click the Update URL button at the bottom and you’ll end up with your ready to use URL.

Example:

http://servername/MicroStrategy/asp/TaskAdmin.aspx?taskId=reportExecute&taskEnv=xml&taskContentType=xml&sessionState=CONTENTS+OF+MIN-STATE+GOES+HERE&styleName=ReportGridStyle&reportID=REPORT_GUID

Answering Prompts
To answer prompts, append the appropriate strings to the end of the URL.
Value Prompts
&valuePromptAnswers=VALUE^VALUE
Multiple values can be passed, separated by a ^
Element Prompts
&elementsPromptAnswers=AttributeGUIDFirst;AttributeGUIDFirst:1;AttributeGUIDFirst:2,AttributeGUIDSecond;AttributeGUIDSecond:1;AttributeGUIDSecond:2

Multiple answers can be passed by separating AttributeGUID:Value pairs with a ;
Multiple prompts can be answered by separating each AttributeGUIDFirst with a ,

Conclusion
The TaskProc can be handy in a quick pinch, or be easier to get off the ground than the Web Services.  It’s pretty intuitive to use since it’s already setup and installed, and the Builder GUI does the heavy lifting for you.  I don’t use it in any day to day tasks, but if you have an interesting use for it, please share in the comments!

UPDATE: MicroStrategy TaskProc Enhancement in 9.2 SDK

You may also like...