From 47ed3e716500039ba709da8f305b93d70fdba0cb Mon Sep 17 00:00:00 2001 From: John Woodlock Date: Fri, 5 Oct 2012 12:23:18 +1000 Subject: [PATCH] WIP api docs update data tables --- api-docs/apiLive.htm | 68 +++++++++---------- .../platform/api/DataTableApiResource.java | 56 +++++++-------- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index fa8dd6217..ee6fbe284 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -2412,14 +2412,14 @@ Request Body:

List Data Tables

- Lists the registered data tables and the Mifos X Core application table they are registered to. + Lists registered data tables and the Mifos X Core application table they are registered to.

Arguments
appTable
optional
-
The Mifos X core table to restrict the output to
+
The Mifos X core application table.

Example Requests:

datatables?appTable=m_client
@@ -2446,6 +2446,38 @@ Request Body:
+   +
+
+

Register Data Table

+

+ Registers a data table with the Mifos X Core application table. +

+
+
+ POST https://Domain Name/api/v1/datatable/{datatable}/{set}/{id} + POST additionalfields/portfolio_client/Additional Information/2 +Content-Type: application/json +Request Body: +{ + "Ethnic_Group":"Berber", + "Ethnic_Group_Other":"", + "Household_Location":"East Sikkim", + "Household_Location_Other":"", + "Religion":"Animist", + "Religion_Other":"jjjjjjj", + "Knowledge_of_Person":"Son/daughter of staff member", + "Gender":"Female", + "Whois":"its\r\nme of\r\ncourse\r\nyes\r\nend and the end of it all" +} + + { + "entityId": 2 +} + +
+
+  
@@ -2523,38 +2555,6 @@ Request Body:
-   -
-
-

Update Additional Fields

-

- Updates (or creates) the Set of Additional Fields data for the ID provided. The ID is the id field of the Type table e.g. portfolio_client might have an id value of 4. -

-
-
- POST https://Domain Name/api/v1/additionalfields/{type}/{set}/{id} - POST additionalfields/portfolio_client/Additional Information/2 -Content-Type: application/json -Request Body: -{ - "Ethnic_Group":"Berber", - "Ethnic_Group_Other":"", - "Household_Location":"East Sikkim", - "Household_Location_Other":"", - "Religion":"Animist", - "Religion_Other":"jjjjjjj", - "Knowledge_of_Person":"Son/daughter of staff member", - "Gender":"Female", - "Whois":"its\r\nme of\r\ncourse\r\nyes\r\nend and the end of it all" -} - - { - "entityId": 2 -} - -
-
- diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/DataTableApiResource.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/DataTableApiResource.java index b11f64b6f..61e460415 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/DataTableApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/DataTableApiResource.java @@ -66,11 +66,11 @@ public class DataTableApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String getDatatables(@QueryParam("appTable") final String apptable, + public String getDatatables(@QueryParam("appTable") final String appTable, @Context final UriInfo uriInfo) { List result = this.readWriteNonCoreDataService - .retrieveDatatableNames(apptable); + .retrieveDatatableNames(appTable); boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo .getQueryParameters()); @@ -79,14 +79,14 @@ public class DataTableApiResource { } @POST - @Path("register/{datatable}/{apptable}") + @Path("register/{datatable}/{appTable}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public Response registerDatatable( @PathParam("datatable") final String datatable, - @PathParam("apptable") final String apptable) { + @PathParam("appTable") final String appTable) { - this.readWriteNonCoreDataService.registerDatatable(datatable, apptable); + this.readWriteNonCoreDataService.registerDatatable(datatable, appTable); EntityIdentifier entityIdentifier = new EntityIdentifier(); return Response.ok().entity(entityIdentifier).build(); @@ -106,11 +106,11 @@ public class DataTableApiResource { } @GET - @Path("{datatable}/{apptableId}") + @Path("{datatable}/{appTableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String getDatatable(@PathParam("datatable") final String datatable, - @PathParam("apptableId") final Long apptableId, + @PathParam("appTableId") final Long appTableId, @QueryParam("sqlFields") final String sqlFields, @QueryParam("sqlOrder") final String sqlOrder, @Context final UriInfo uriInfo) { @@ -118,7 +118,7 @@ public class DataTableApiResource { checkUserPermissionForDatatable(datatable, "READ"); GenericResultsetData results = this.readWriteNonCoreDataService - .retrieveDataTableGenericResultSet(datatable, apptableId, + .retrieveDataTableGenericResultSet(datatable, appTableId, sqlFields, sqlOrder, null); String json = ""; @@ -134,34 +134,34 @@ public class DataTableApiResource { } @POST - @Path("{datatable}/{apptableId}") + @Path("{datatable}/{appTableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public Response newDatatableEntry( @PathParam("datatable") final String datatable, - @PathParam("apptableId") final Long apptableId, + @PathParam("appTableId") final Long appTableId, final String jsonRequestBody) { checkUserPermissionForDatatable(datatable, "CREATE"); Map queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody); this.readWriteNonCoreDataService.newDatatableEntry(datatable, - apptableId, queryParams); + appTableId, queryParams); EntityIdentifier entityIdentifier = new EntityIdentifier( - Long.valueOf(apptableId)); + Long.valueOf(appTableId)); return Response.ok().entity(entityIdentifier).build(); } @PUT - @Path("{datatable}/{apptableId}") + @Path("{datatable}/{appTableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public Response updateDatatableEntryOnetoOne( @PathParam("datatable") final String datatable, - @PathParam("apptableId") final Long apptableId, + @PathParam("appTableId") final Long appTableId, final String jsonRequestBody) { /* * for updating one to one relationships (where foreign key is the @@ -171,22 +171,22 @@ public class DataTableApiResource { Map queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody); this.readWriteNonCoreDataService.updateDatatableEntryOnetoOne( - datatable, apptableId, queryParams); + datatable, appTableId, queryParams); EntityIdentifier entityIdentifier = new EntityIdentifier( - Long.valueOf(apptableId)); + Long.valueOf(appTableId)); return Response.ok().entity(entityIdentifier).build(); } @PUT - @Path("{datatable}/{apptableId}/{datatableId}") + @Path("{datatable}/{appTableId}/{datatableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public Response updateDatatableEntryOnetoOne( @PathParam("datatable") final String datatable, - @PathParam("apptableId") final Long apptableId, + @PathParam("appTableId") final Long appTableId, @PathParam("datatableId") final Long datatableId, final String jsonRequestBody) { /* @@ -197,51 +197,51 @@ public class DataTableApiResource { Map queryParams = getQueryParamsFromJsonRequestBody(jsonRequestBody); this.readWriteNonCoreDataService.updateDatatableEntryOnetoMany( - datatable, apptableId, datatableId, queryParams); + datatable, appTableId, datatableId, queryParams); EntityIdentifier entityIdentifier = new EntityIdentifier( - Long.valueOf(apptableId)); + Long.valueOf(appTableId)); return Response.ok().entity(entityIdentifier).build(); } @DELETE - @Path("{datatable}/{apptableId}") + @Path("{datatable}/{appTableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public Response deleteDatatableEntries( @PathParam("datatable") final String datatable, - @PathParam("apptableId") final Long apptableId) { + @PathParam("appTableId") final Long appTableId) { checkUserPermissionForDatatable(datatable, "DELETE"); this.readWriteNonCoreDataService.deleteDatatableEntries(datatable, - apptableId); + appTableId); EntityIdentifier entityIdentifier = new EntityIdentifier( - Long.valueOf(apptableId)); + Long.valueOf(appTableId)); return Response.ok().entity(entityIdentifier).build(); } @DELETE - @Path("{datatable}/{apptableId}/{datatableId}") + @Path("{datatable}/{appTableId}/{datatableId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public Response deleteDatatableEntries( @PathParam("datatable") final String datatable, - @PathParam("apptableId") final Long apptableId, + @PathParam("appTableId") final Long appTableId, @PathParam("datatableId") final Long datatableId) { checkUserPermissionForDatatable(datatable, "DELETE"); this.readWriteNonCoreDataService.deleteDatatableEntry(datatable, - apptableId, datatableId); + appTableId, datatableId); EntityIdentifier entityIdentifier = new EntityIdentifier( - Long.valueOf(apptableId)); + Long.valueOf(appTableId)); return Response.ok().entity(entityIdentifier).build();