I want to access the Reports Repository like the i-net Designer from my own client. How can I do it?
Note the repository is obsolete as of version 24.4. It is migrated into the Drive and you can use the Drive Web API to access reports.
I want to access the Reports Repository like the i-net Designer from my own client. How can I do it?
Note the repository is obsolete as of version 24.4. It is migrated into the Drive and you can use the Drive Web API to access reports.
Since version 14.x the designer use a JSON-RPC API to access the remote repository. See the Wikipedia for details to JSON-RPC.
The same API is used in version 15.x and 16.x. There is no warranty that this will work in future versions. Currently there is no plan to change this in the future.
System requirments:
URL: <server base url>/jsonrpc/repository
Structures:
Methods:
All available methods of your version can be found in the enum com.inet.report.plugins.json.repository.shared.RepositoryMethods in the jsonrepository plugin.
The follow method documentation use a Java method declarartion like it will be used with a wrapper.
FolderDescription = Root()
List<FolderDescription> = Folders(String parent)
FolderDescription = Folder(String parent, String name)
List = Files(String parent)
FileDescription = File(String parent, String name)
FolderDescription = CreateFolder(String parent, String name)
FileDescription = CreateFile(String parent, String name)
FileDescription/FolderDescription = Rename(String parent, String name)
Boolean = Delete(String element)
Exists
Boolean = Exists(String element)
Thumbnail
ASCII-String = Thumbnail(String name)
List = Keywords(String name)
Boolean = SetKeywords(String name, String… keywords)
List = Search(String phrase)
String = ServerVersion()
Boolean = Save(String name, ASCII-String data)
ASCII-String = Load(String name)
Protocol Sample:
→ {“jsonrpc”: “2.0”, “method”: “Root”, “id”: 3}
← {“jsonrpc”: “2.0”, “result”: {“name”:“foo.rpt”,“rights”:0,“foldertype”:0}, “id”: 3}
Usage with JSON-RPC 2.0 library JSON-RPC 2.0 : Java Client Library
This library is very strict. You need the patched version 14.1.660 or higher.
Sample code:
import java.net.URL;
import com.thetransactioncompany.jsonrpc2.JSONRPC2Request;
import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2Session;
public class JsonRpcTest {
public static void main( String[] args ) throws Exception { URL serverURL = new URL( "http://localhost:9000/jsonrpc/repository" );
JSONRPC2Session session = new JSONRPC2Session( serverURL ); JSONRPC2Request request = new JSONRPC2Request("Root", null); String[] contentTypes = {"application/binary-json", "application/error-json", "application/clearreport-json"}; session.getOptions().setAllowedResponseContentTypes(contentTypes); JSONRPC2Response response = session.send(request);
if (response.indicatesSuccess()) { System.out.println(response.getResult()); } else { System.out.println(response.getError().getMessage()); System.out.println(response.getError().getCode()); } }
}