Support > Wagby Developer Network(R7) > REST API usage guide > Search/Get ​​list data

Search results are held by the server, and results can be obtained on a page basis.

It is a method of specifying the search condition by parameter.

URL Example

http://localhost:8921/wagby/rest/customer/list?customer_cp$002fname=Suzuki

response

Here is an example of the content of the return.

{
 "result": {
   "size": 1,
   "next": 1,
   "current": 1,
   "nextPage": false,
   "prevPage": false
 },
 "errors": {
   "jfcinfo": [],
   "jfcwarn": [],
   "jfcdebug": [],
   "jfcerror": []
 },
 "status":"ShowListCustomerController.input",
 "entity": [
   {
     "customerid_": 1000,
     "name_": "Suzuki",
     "email_": []
   }
 ],
 "listp": {
   "sortable_": "customerid",
   "sort_": "",
   "order_": "",
   "item_": [
     {
       "customerid_":"1000",
       "name_":"Suzuki"
     }
   ]
 },
 "conditionp": {
   "name_": {
     "content_":"Suzuki",
     "formatted_": null,
     "errorcode_":""
   }
 }
}
@RequestMapping(value="/rest/[modelid]/list", method=POST, headers={"Content-Type=application/x-www-form-urlencoded"})

Parameters

Specify the same parameters as the form screen as POST.
Example:
customer_cp$002fname=Suzuki

response

It is similar to "$ {content_ 0 _ name}".

@RequestMapping(value="/rest/[modelid]/list", method=POST, headers={"Content-Type=application/json"})

HTTP header

Content-Type:application/json

Request description

Specifies the JSON representation of the presentation object of the condition.

{
   "name_": {
     "content_":"Suzuki"
   }
}

Handling of choose attribute

Items prepared as checkboxes are given a choose attribute in their choices. When including this in the search condition, change the choose attribute totrueTo the server.

{
  "jgroupid_": [
    { 
    "id_": "1000",
    "choose_":true
    }
  ]
}

response

It is similar to "$ {content_ 0 _ name}".

@RequestMapping(value="/rest/[modelid]/list/next", method=GET)

response

It is similar to "$ {content_ 0 _ name}".

@RequestMapping(value="/rest/[modelid]/list/prev", method=GET)

response

It is similar to "$ {content_ 0 _ name}".

@RequestMapping(value="/rest/[modelid]/list/first", method=GET)

response

It is similar to "$ {content_ 0 _ name}".

@RequestMapping(value="/rest/[modelid]/list/last", method=GET)

response

It is similar to "$ {content_ 0 _ name}".

@RequestMapping(value="/rest/[modelid]/jump/[firstresult]", method=GET)

Firstresult specifies the number of search results (record number) to be retrieved.
If you specify a number greater than the number of search results, you get the last page (last).

For example, if the number per page (number of acquisitions) is 10, specifying 10 will display the 2nd page, specifying 20 will display the 3rd page.

Example 1

http://localhost:8921/wagby/rest/customer/list/jump/1

Retrieve the search results of the first page (first to tenth).If a number from 0 to 9 is specified, it is the 1st page.

Example 2

http://localhost:8921/wagby/rest/customer/list/jump/10

A search result of the second page (eleventh to twentieth) is acquired.If a number from 10 to 19 is specified, it becomes the second page.

Example 3

http://localhost:8921/wagby/rest/customer/list/jump/20

Search results of the third page (21st to 30th) are acquired.If you specify a number from 20 to 29, it is the third page.

response

It is similar to "$ {content_ 0 _ name}".

@RequestMapping(value="/rest/[modelid]/changeSizePerPage", method=POST, headers={"Content-Type=application/x-www-form-urlencoded"}, params="__jfc_size_per_page")

Parameters

ParametersDescription
__jfc_size_per_pageNumber per page

response

It is similar to "$ {content_ 0 _ name}".

Using the request parameter

The control parameters that can be assigned to the search parameters are as follows.

ParametersDescription
pagesizejshparamNumber of acquisitions
firstresultjshparamStart count
sortkeyjshparamSort key

Example 1:
When firstresultjshparam = 0 is set, retrieve from the top of the search result up to the number of "display on page" in the list display.

Example 2:
When firstresultjshparam = 10 is set, from the tenth search result, up to the number of "display number on page" in the list display is acquired.

Example 3:
If you set pagesizejshparam = 100 & firstresultjshparam = 10, we will retrieve the 10th to 110th search results.

Example 4:
If you specify sortkeyjshparam = customerid: DESC, you get the result of sorting customerid items in descending order.

Using JSON objects

For JSON objects, it looks like this:

ParametersDescription
pagesizeNumber of acquisitions
firstresultStart count
sortkeySort key

例:

{
       "pagesize": 100,
       "firstresult": 10,
       "sortkey": "customerid:DESC"
}