Difference between revisions of "Integration/REST"
Jump to navigation
Jump to search
Tags: Visual edit: Switched Manual revert |
(Notet version changes and new endpoints) |
||
Line 4: | Line 4: | ||
Please download the original article: [http://www.tempusserva.dk/articlebase/Tempus%20Serva%20REST%20interface.pdf Tempus Serva REST interface.pdf] | Please download the original article: [http://www.tempusserva.dk/articlebase/Tempus%20Serva%20REST%20interface.pdf Tempus Serva REST interface.pdf] | ||
The rest interface has two versions. | |||
* v1, XML-version (default) | |||
* v2, JSON-version | |||
== Netbeans quick start guide == | |||
== Version 1 == | |||
=== Netbeans quick start guide === | |||
Steps to create a simple interaction | Steps to create a simple interaction | ||
Line 65: | Line 71: | ||
When logged in the following URLs are available without further authentication | When logged in the following URLs are available without further authentication | ||
Data list operations: GET, PUT | Data list operations: GET, PUT, POST | ||
<syntaxhighlight lang="ini"> | <syntaxhighlight lang="ini"> | ||
https://<server>/<application>/rest/<solution> | https://<server>/<application>/rest/<version>/<solution> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Data item operations: GET, POST | Data item operations: GET, PUT, POST, DELETE | ||
<syntaxhighlight lang="ini"> | <syntaxhighlight lang="ini"> | ||
https://<server>/<application>/rest/<solution>/<DataID> | https://<server>/<application>/rest/<version>/<solution>/<DataID> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
'''Note: The fowllowing file handling endpoints are scheduled for Q2 2020''' | '''Note: The fowllowing file handling endpoints are scheduled for Q2 2020''' | ||
File list operations: | File list operations: PUT, POST | ||
<syntaxhighlight lang="ini"> | <syntaxhighlight lang="ini"> | ||
https://<server>/<application>/rest/<solution>/<DataID>/<FieldName>/ | https://<server>/<application>/rest/<version>/<solution>/<DataID>/<FieldName>/ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
File item operations: GET | File item operations: GET, PUT, POST, DELETE | ||
<syntaxhighlight lang="ini"> | <syntaxhighlight lang="ini"> | ||
https://<server>/<application>/rest/<solution>/<DataID>/<FieldName>/< | https://<server>/<application>/rest/<version>/<solution>/<DataID>/<FieldName>/<FileName> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 10:56, 13 May 2024
Introduction to the REST interface
This article has not yet been fully converted to Wiki format.
Please download the original article: Tempus Serva REST interface.pdf
The rest interface has two versions.
- v1, XML-version (default)
- v2, JSON-version
Version 1
Netbeans quick start guide
Steps to create a simple interaction
- Add Webservice to ide (wadl import)
- URL: [ServerName]/[ApplicationName]/rest/[SolutionSystemName].wadl
- If import causes trouble: Download the wadl file
- Create a new project
- Add REST Client to project
- Point to newly created webservice: [SolutionSystemName]
- Add JAXB bindings to project (use XSD schema)
- URL: [ServerName]/[ApplicationName]/rest/[SolutionSystemName].xsd
- If import causes trouble: Download the xsd file
- Add REST Client to project
Sample code for list view (BASIC athentication)
//Create session
FirmabilerClient session = new FirmabilerClient();
session.setUsernamePassword("admin", "password1223");
//Set search parameters (first parameter is a dummy)
FirmabilerList result = session.getList(FirmabilerList.class, "", "TITEL=Kasper" );
//Retrieve data and print
List <FirmabilerListItem> list = result.getFirmabilerListItem();
for(int i=0; i<list.size(); i++) {
//Handle single item
FirmabilerListItem item = list.get(i);
System.out.println( item.getDataID() + "\t" + item.getNUMMERPLADE() );
}
//Close connection
session.close();
Sample code for list view (parameter credentials)
//Create session
FirmabilerClient session = new FirmabilerClient();
//Login and set search parameters
FirmabilerList result = session.getList(FirmabilerList.class, "admin", "password1223", "TITEL=Kasper" );
//Retrieve data and print
List <FirmabilerListItem> list = result.getFirmabilerListItem();
for(int i=0; i<list.size(); i++) {
//Handle single item
FirmabilerListItem item = list.get(i);
System.out.println( item.getDataID() + "\t" + item.getNUMMERPLADE() );
}
//Close connection
session.close();
URL structure
When logged in the following URLs are available without further authentication
Data list operations: GET, PUT, POST
https://<server>/<application>/rest/<version>/<solution>
Data item operations: GET, PUT, POST, DELETE
https://<server>/<application>/rest/<version>/<solution>/<DataID>
Note: The fowllowing file handling endpoints are scheduled for Q2 2020
File list operations: PUT, POST
https://<server>/<application>/rest/<version>/<solution>/<DataID>/<FieldName>/
File item operations: GET, PUT, POST, DELETE
https://<server>/<application>/rest/<version>/<solution>/<DataID>/<FieldName>/<FileName>
Query parameters
The REST API supports the same filtering and search parameters, as the list-command Integration/Content_source.