Arelle’ web service API, based on REST, provides XBRL services to non-Python applications, such as Excel, Java, and C#.

The web services can operate as a stand-alone single-process web server, or can operate under another web server. When operating stand-alone and in a single-process, Arelle can interact with multiple interfaces and requests without reloading its object model, such as QuickBooks XBRL-GL interfaces or separate API requests to perform subsequent operations on the same object model. When operating under an independent web server (such as IIS or Apache) the examples below have each REST API request handled as an independent request in an independent process, using CGI, which is suitable for a production environment. In each of these Arelle operates from its compiled binary application, without requiring installing of Python and python library packages within the web server.

To start as a simple stand-alone web server (where the Arelle executable handles the web service requests itself, e.g., without using IIS or Apache):

The default port is “localhost:8080”. The windows port can be changed by editing properties of the “Start Web Server” menu shortcut, .bat/.command file, or command line parameter. The web server is terminated by cntrl-C to the webserver’s window.

The simple stand-alone web server REST API starts with “/”, so REST APIs start with the path http://localhost:8080/rest/xbrl/..., or help is at http://localhost:8080/help

The next two options provide Arelle’s REST API using web servers like IIS or Apache, invoking Arelle from the compiled binary application distribution for each.
To start as a CGI process under IIS, where each request will run as an independent process:

Install the Windows executable. arelleCmdLine.exe will detect when it is running as a CGI.

Install IIS features for CGI (if not yet present in IIS).

Add a web site for the CGI, with its own port number (such as 8080), an application pool, advanced settings physical path to C:\Program Files\Arelle (or your installation location). Set permissions on that directory (such as Everyone or IIS processes, so they can write the web.config directory and any other files as needed).

Set application pool framework version at 2.0, and maximum worker processes at number of CPU cores available (under advanced properties).

Add handler mapping for Arelle, similar to this, using * so REST paths to go into Arelle:

Request path: *

Executable: “C:\Program Files\Arelle\arelleCmdLine.exe” %s

Name: Arelle

Arelle’s cache directory for IIS defaults to

C:\Windows\Temp\Arelle

, and is created on initial startup for you. This can be confirmed by REST API

/rest/configure?environment

. If you copy into this directory be sure to set permissions, such as IUSR.

Here are contributed steps by another user to set up Arelle under IIS:

1.For security reasons every CGI has to be registered in the ISAPI/CGI Restriction list: Right click on Web server name and double click on ISAPI and CGI Restrictions. Add C:\ArelleCGI\arelleCmdLine.exe with desc: arelleCmdLine and check “Allow extension path to execute”

2.Create web site with port number pointing to c:\ArelleInstallFolder(and or virtual directory under existing web site or newly created). If a web site is created it will by default assign AppPoolIDForOurApp as the security identity
under which the new web server will run.

We still don’t allow “Execute” access in this directory. For this you have to go to the Handler Mappings menu of the CGI virtual directory (make sure you select the CGI virtual directory on the left hand side!).

Go to the “Edit Feature Permissions” link in the Actions Menu on the right hand side, open it and check “Execute” and click “OK”.

3.Double click on CGI-exe in Handler Mappings (default name of the mapping that we enabled in step 2, but it needs to be configured) to edit this mapping
Request path = *.exe
Executable = C:\ArelleIISCGI\arelleCmdLine.exe %s –xdgConfigHome=”C:\ArelleIISCGI\cache”

4.We need to add IIS APPPOOL\AppPoolIDForOurApp account to the physical folder where Arelle was installe e.g. c:\ArelleInstallFolder (default permissions read are fine – since we are not writing to it.)

5.Modify IIS APPPOOL\AppPoolIDForOurApp permissions on c:\ArelleInstallFolder\cache folder (or whatever folder will be used to store Arelle config and cache) to include write permissions (read permissions are fine if we have cache already, but if we are able to get through the proxy or we have open access to the Internet write access is needed)

To start as a CGI installed under an Apache web server, where each request will run as a separate process:

Ensure that the web server has mod-cgi installed and a working cgi directory (such as /usr/lib/cgi-bin, as with Ubuntu). Do not specify AcceptPathInfo (otherwise it will block the REST path following arelleCmdLine in the URL path).

Unzip the Linux executable within the mod-cgi directory (such as to a subdirectory arelle, so the path to arelleCmdLine is /usr/lib/cgi-bin/arelle/arelleCmdLine). Ensure permissions will allow the web server to access the directory and execute. The executable arelleCmdLine detects when it is running as a CGI instead of from a command script or shell.

Arelle needs a cache directory. With Ubuntu this defaults to /var/www/.config/arelle. Create those directories (probably needs sudo) and set their owners and groups (with Ubuntu user and group are set to www-data).

This Apache web server configuration REST API starts with /cgi-bin/arelle/arelleCmdLine, so REST APIs start with the path http://myhost.com/cgi-bin/arelle/arelleCmdLine/rest/xbrl/..., or help is at http://myhost.com/cgi-bin/arelle/arelleCmdLine/help

(There are other alternatives to running Arelle as a stand-alone single-process web server or running from compiled binary application distribution. The single-process mode can use other servers supported by Python Bottle, some of which, like CherryPy, have multi-processing support. The source code supports use as an WSGI application (automatically detected on start up of arelleCmdLine.py), which can be deployed in a web server which has managed Python support and source code integration expertise. The Python 2.7 version of Arelle has been installed on Google App Engine (GAE), such as for api.arelle.org.)

Below is a table of the API from Arelle’s web service. API implemented by the installed version of Arelle is obtained by starting Arelle’s web services and clicking (or entering this link to your browser – it assumes use of the default port, 8080): http://localhost:8080/help.

Web Service API

tr>

Arelle web API

/help

This web page.

/about

About web page, copyrights, etc.

Validation

/rest/xbrl/​{file}/​validation/​xbrl

Validate document at {file}.

{file} may be local or web url, and may have “/” characters replaced by “;” characters (but that is not
necessary).

Parameters are required following “?” character, and are separated by “&” characters,
as follows:

proxy

Show or modify and re-save proxy settings:Enter ‘show’ to view current setting, ‘system’ to configure to use system proxy setting, ‘none’ to configure for no proxy, or ‘http://[user[:password]@]host[:port]’ (e.g., http://192.168.1.253, http://example.com:8080, http://joe:secret@example.com:8080).” ))

plugins

Show or modify and re-save plug-ins configuration:Enter ‘show’ to view plug-ins configuration, , or ‘|’ separated modules:
+url to add plug-in by its url or filename (relative to plug-in directory else absolute), ~name to reload a plug-in by its name, -name to remove a plug-in by its name,
(e.g., ‘+http://arelle.org/files/hello_web.py’, ‘+C:\Program Files\Arelle\examples\plugin\hello_dolly.py’ to load,
~Hello Dolly to reload, -Hello Dolly to remove). (Note that plug-ins are transient on Google App Engine, specify with &plugins to other rest commands.)

packages

Show or modify and re-save taxonomy packages configuration:Enter ‘show’ to view packages configuration, , or ‘|’ separated package URLs:
+url to add package by its full url or filename, ~name to reload a package by its name, -name to remove a package by its name.
(Note that packages are transient on Google App Engine, specify with &packages to other rest commands.)

This project is Python (not Java). There is an example of a Java interface, using the web service, in the example folder of the github source code. If you want to know if it is helpful please be specific and clear about your requirements and goals.

Sorry Sir,
My goal is to parse xbrl file using java program and extract the data from file.I thought, in your java program the line (string variable ) what you printed is output for me .so i choose this way to parse xbrl.but i’m stuck with the error mentioned above.

I have setup the web service API on my local. written a .Net wrapper around it. so far so good. when we Validate how do we get specific error codes, sometimes these codes will decide a go or no go further into the actual extraction of the xbrl. for instance if the Arelle is not able to load a taxanomy it returns a bunch of text. but would be helpful if it throws an exception or an error code so that the developer will decide if we need to proceed further.

The logger output via plain text is difficult to automate. I suggest instead that you try the xml (or json) logger output (&media=xml). These other output forms provide the error code, the severity level, messages not only in text but the arguments to the text string (so you can customize the messages), and provide filtering for severity level, hrefs to each error cause, and property descriptions of the objects causing errors.

Thanks, I like this product. I was able to extract a cash dividend using the Web service and I changed my output for validation to xml. when I get facts I get the first line:
Label,,Seq,contextRef,unitRef,Dec,Value,EntityScheme,EntityIdentifier,Start,End/Instant

Question 1:
why I am getting an empty ,, after Label.
Question 2:
how do I relate the facts I got from facts and the concepts. I see contextRef in facts but it is not returned in concepts.

Q1: The extra ,, looks like an error in determining tuple depth in CSV output (will fix for next build). If there were tuples, extra columns are needed to show the indentation under tuples. (Bugs can be reported via http://arelle.atlassian.net).

Q2: contextRef is only in instance documents, so it is shown on fact output, but contexts are not part of the taxonomy (so they are not shown on concept listing). The facts can be related by their label (if unique) or their qname (&labelRole=XBRL-concept-name would specify that the facts list should show the QName instead of standard label)

i am using web service to extract information../FactTable works fine.. but how can i combine FactListCol along with FactTable.. so i can get all hierarchical data with values..
also /FactTable displays instead i want how can i do that ?

There’s a command /rest/stopWebServer. I’m not able to get it to work correctly on Windows. I suggest adding an issue to arelle.atlassian.net if you need this feature debugged. Also let us know the platform you are using.

Thanks for response.. one more question.. so FactTable gives which is the link… but what if i want the description from Schema XSD file..something like 001 …? also is there a way to filter out all disclosures that come in SEC company fillings, from actual result…

i’m testing the web service for some time now. Receiving all concepts, the presentation linkbase and the calculation linkbase works just fine for any given taxonomy! What i need is to get all information available for concepts that resides in the lable and reference linkbases. Is there any way to achieve this? It would be great if you could help me with that!

Another question is, would it be possible to run the server using Linux?

Yes, I think so, there are several articles you can find by Google on python as a windows service, they would involve some serious source code level work. The webservice uses Python Bottle, which is pretty general (for example it runs fine on Google App Engine). However interfacing the python language environment as a Windows Service may need more in-depth Python and Windows experiences. It may also be possible to interface the command line interface to a windows service (vs. the webservice under Python Bottle).

If you need professional support on this topic to assist in source code level integration, please contact support@arelle.org.

I’m not sure if the \\servername will get through right. Have you tried the alternate format, /rest/xbrl/validation?file=c:/a/b/c.xbrl or is there an ip address for servername such as file=http://192.168.1.1/a/b/c.xbrl ?

Thanks for reporting this, JIRA ticket is https://arelle.atlassian.net/browse/ARELLE-324. The entry point file (such as an instance document) and any other local-authority files (of a submission) need to be timestamp checked to see if they’ve been replaced (but not the standard taxonomy files, such as xbrl.org, fast, or firs).

There seems to be a bug with generating output files when using Arelle as a webservice. Generating a facts.xml file using the command line works fine, but when I do the same using the Arelle webservice, it outputs a very different format. BTW, I am using an unreleased build dated July 06.

Wondering if there is a way to retrieve the actual unit, rather than the unitRef when using the web API to generate a factlist? Looking at the code, it appears that no option exists. The unitRef is much less useful as it can vary from filing to filing.

In the JSon response for facts, I could see there are duplicate name \ label entries – by looking at the contextRef , we could identify that it is for the previous fillings (with the data for the previous fillings) – seems that contextRef naming seems to be inconsistent;
How could we determine the data name \ label to be used for the determining the values for current fillings (can we remove the duplicate).

When I run the web server supplied everything works properly. Any ideas.. I am guessing it is a permissions issue possibly and can not write to a directory. The Arelle temp directory has IUSR rights. But What i can not figure out is where Arelle puts the files when I upload. I thought it would put it in the temp directory but when I run iis or the supplied web server it does not put it in the temp directory. Any help would be appreciated. If you need more info let me know

I’m not sure where they go by default, it would be something like /users/???/AppData/Local/cache. The environment variable XDG_CONFIG_HOME or parameter –xdgConfigHome can be used to provide a different location for the cache of web-retrieved files.

I would like the database to for US Public XBRL to only contain information for document types 8-Q, 8-K, 10-Q, and 10-K. May I please ask how I could do this, as it would also cut down the database size.