-
Notifications
You must be signed in to change notification settings - Fork 612
JSON API
JSON is one of the three available channels to access the methods of the Service Interfaces.
The JSON interface is mainly there to facilitate connecting to the BIMserver from web applications/web sites. It is however also very useful when connecting from other applications like for example web servers or BIM/CAD software.
For this purpose we have created a small JavaScript library, this library is being served by all BIMservers on [address]/js/bimserverapi.js. Your code should download it, and then instantiate the API like this:
var bimServerApi = new BimServerApi("http://examplebimserver:port");
Have a look at the [http://code.google.com/p/bimserver/wiki/JavaScriptApi JavaScriptApi] page for more details on the JavaScript API.
For every call you should send an HTTP POST request to http://[address]:[port]/[optional context]/json. The body of this request should be an UTF-8 encoded JSON message. The structure of this message is the following:
{
token: "ABCDEF1234567890",
request: {
interface: "ServiceInterface",
method: "getAllProjects",
parameters: {
onlyTopLevel: true
}
}
}
Of course the required parameters depend on the actual method you are calling. All parameters are always required. For almost all calls you have to include a valid token. The token can be obtained by 2 methods: "login" or "autologin". Those 2 methods do not require a token themselves.
A typical response for a "login" call looks like this:
{
response: {
result: "ABCDEF012345567890"
}
}
When an exception occurs the message looks like this:
{
response: {
exception: {
__type: "UserException",
message: "User account has been deleted"
}
}
}
The "__type" parameters here helps client-side libraries to construct and throw appropriate exception.
Sometimes it's useful to call multiple remote methods in one request. For example in asynchronous languages like javascript you sometimes want to combine the results of multiple calls, which would result in a sequence of chronologically executed calls, resulting in acummulated latency and unreadable code.
{
token: "ABCDEF1234567890"
requests: [{
interface: "ServiceInterface",
method: "getAllProjects",
parameters: {
onlyTopLevel: true
}
}, {
...another call...
}]
}
Notice that the same token is used for all calls. The response looks like this:
{
responses: [{
result: "ABCDEF012345567890"
}, {
exception: {
__type: "UserException",
message: "User account has been deleted"
}
}]
}
In this response the first call executed successfully, and the second call failed. Note that all responses have the same array index as their corresponding request objects.
Get Started
- Quick Guide
- Requirements Version 1.2
- Requirements Version 1.3
- Requirements Version 1.4
- Requirements Version 1.4 > 2015-09-12
- Requirements Version 1.5
- Download
- JAR Starter
- Setup
Deployment
- Ubuntu installation 1.3
- Windows installation
- Security
- Memory Usage
- More memory
- Performance statistics
- Large databases
Developers
- Service Interfaces
- Common functions
- Data Model
- Low Level Calls
- Endpoints
Clients
BIMServer Developers
- Plugins in 1.5
- Plugin Development
- Eclipse
- Eclipse Modeling Framework
- Embedding
- Terminology
- Database/Versioning
- IFC STEP Encoding
- Communication
- Global changes in 1.5
- Writing a service
- Services/Notifications
- BIMserver 1.5 Developers
- Extended data
- Extended data schema
- Object IDM
New developments
- New remote service interface
- Plugins new
- Deprecated
- New query language
- Visual query language
- Reorganizing BIMserver JavaScript API
General