Skip to content

Operational Data Rest API

bahadirodevci edited this page Aug 20, 2016 · 9 revisions

Operational data Rest API can be used to insert operational data to the Imona platform.

Authentication method

Basic authentication is used. Provide your username & password in each request.

Services

Insertion Service

Service URL: /rest/data/{appShortName}/{entityName}
Method: POST
Description: Inserts the given bean as a DB record to the table for the entity of the specified app. Returns the inserted bean, which now has its embedded fields filled by the platform (such as its id, timestamp etc.)

The request body contains the bean, which needs to implement the ImonaBean interface:

public Long getId();
public void setId(Long id);
public Long getImona_version();
public void setImona_version(Long imonaVersion);
public Date getHostts();
public void setHostts(Date hostts);
public String getWsid();
public void setWsid(String wsid);
public String getUserid();
public void setUserid(String userId);
public Boolean getApprvd();
public void setApprvd(Boolean apprvd);
public Float getLatitude();
public void setLatitude(Float latitude);
public Float getLongitude();
public void setLongitude(Float longitude);  

These fields are not required to be filled as the request is being made. Some of them (id, imona_version and hostts) will be filled by the platform if they're missing, sent back in its reponse.

If a record that already exists is to be updated, id and imona_version properties need to be filled.


Get Count Service

Service URL: /rest/data/count/{appShortName}/{entityName}
Method: GET
Description: Returns the number of records that the DB has for the specified entity. A single long value is returned.


List Records With Page Number Service

Service URL: /rest/data/{appShortName}/{entityName}?pageNum={pageNum}
Method: GET
Sample: https://www.imona.com/platform/rest/data/tstprj/customer?pageNum=1
Description: Returns the records in DB that correspond to the specified entity as a list, ten records at a time. pageNum starts from 1. If a request that has a pageNum greater than the number of pages for the entity (numberOfRecords/10) is made, empty list is returned.

Response example:

[
	{"imona_version":0,"age":0,"name":"jdgfjdfgsfd","surname":null,"hostts":1387889122000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":13},
	{"imona_version":0,"age":0,"name":"hjdfgdfgdfg","surname":null,"hostts":1387889125000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":14},
	{"imona_version":0,"age":0,"name":"hahjdhfh","surname":null,"hostts":1387889128000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":15},
	{"imona_version":0,"age":0,"name":"ashdasfghdfh","surname":null,"hostts":1387889130000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":16},
	{"imona_version":0,"age":0,"name":"reergefrfgdfg","surname":null,"hostts":1387889133000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":17},
	{"imona_version":0,"age":0,"name":"hjdjergfg","surname":null,"hostts":1387889135000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":18},
	{"imona_version":0,"age":0,"name":"herdfgdfh","surname":null,"hostts":1387889136000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":19},
	{"imona_version":0,"age":0,"name":"djhdfjergfg","surname":null,"hostts":1387889138000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":20},
	{"imona_version":0,"age":0,"name":"dsfjegerfgfdhdh","surname":null,"hostts":1387889141000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":21},
	{"imona_version":0,"age":0,"name":"erjhertgdfgdfh","surname":null,"hostts":1387889143000,"userid":"imona1@imona1.com","wsid":"127.0.0.1","apprvd":true,"latitude":-1.0,"longitude":-1.0,"id":22}
]  

Fetch Image Service

Service URL: /rest/imageService/{appShortName}/{entityName}/{termName}/id/resim
Method: GET
Sample: https://www.imona.com/platform/rest/imageService/imona/drapp/kullanici/1/resim Description: Returns the image that is contained in the specified term of the specified entity for the record with id provided as the query parameter. A JSON object with a single property named bytes is returned, which holds the image data as a byte array in it.

l

Clone this wiki locally