You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

page_count

The page_count keyword returns the page count of the current resultset.

Note: This keyword is only available in a page context.

Note: This keyword only returns a value if a query and a result is present in the page.

Search results for "page_count"

Result Object

Key Description
result Array of result objects
query_time Time it took to run the query (in seconds)
result_count Number of results in the database (if fewer than the soft limit)
page_count Number of pages in a paginated result
result_count_time Time it took to count the result objects (in seconds)
serialization_time Time it took to serialize the JSON response (in seconds)

put

admin@Structr> put /Project/61e5023298924ba78113902a224d7eab { name: "Project 2000" }
PUT http://0.0.0.0:8082/structr/rest/Project/61e5023298924ba78113902a224d7eab
HTTP/1.1 200 OK
{
"result": [],
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000122587",
"serialization_time": "0.000398315"
}
admin@Structr>

as

anonymous@Structr> as admin:admin get /Project
GET http://0.0.0.0:8082/structr/rest/Project
HTTP/1.1 200 OK
{
"result": [
{
"id": "d8070ae07cde4b6d9d6302acb6115e91",
"type": "Project",
"name": "Test"
},
{
"id": "9f040115a5744526801a6b1f733b2de6",
"type": "Project",
"name": "Project 1"
},
{
"id": "7159a1e615f240ada4f160ea7e3280b8",
"type": "Project",
"name": "Important Project"
}
],
"query_time": "0.000044398",
"result_count": 3,
"page_count": 1,
"result_count_time": "0.000163029",
"serialization_time": "0.000775854"
}
anonymous@Structr>

del

admin@Structr> del /Project/7159a1e615f240ada4f160ea7e3280b8
DELETE http://0.0.0.0:8082/structr/rest/Project/7159a1e615f240ada4f160ea7e3280b8
HTTP/1.1 200 OK
{
"result": [],
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000117125",
"serialization_time": "0.000387572"
}
admin@Structr>

auth

anonymous@Structr> auth admin admin
admin@Structr> get /Project
GET http://0.0.0.0:8082/structr/rest/Project
HTTP/1.1 200 OK
{
"result": [
{
"id": "d8070ae07cde4b6d9d6302acb6115e91",
"type": "Project",
"name": "Test"
},
{
"id": "9f040115a5744526801a6b1f733b2de6",
"type": "Project",
"name": "Project 1"
},
{
"id": "7159a1e615f240ada4f160ea7e3280b8",
"type": "Project",
"name": "Important Project"
}
],
"query_time": "0.000061141",
"result_count": 3,
"page_count": 1,
"result_count_time": "0.000137478",
"serialization_time": "0.000653689"
}
admin@Structr>

delete

Unnamedadmin@Structr> del /Project/7159a1e615f240ada4f160ea7e3280b8
DELETE http://0.0.0.0:8082/structr/rest/Project/7159a1e615f240ada4f160ea7e3280b8
HTTP/1.1 200 OK
{
"result": [],
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000117125",
"serialization_time": "0.000387572"
}
admin@Structr>

get

admin@Structr> get /Project/7159a1e615f240ada4f160ea7e3280b8
GET http://0.0.0.0:8082/structr/rest/Project/7159a1e615f240ada4f160ea7e3280b8
HTTP/1.1 200 OK
{
"result": {
"id": "7159a1e615f240ada4f160ea7e3280b8",
"type": "Project",
"name": "Important Project"
},
"query_time": "0.000615899",
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000125307",
"serialization_time": "0.000463219"
}

admin@Structr>
admin@Structr> get /Project
GET http://0.0.0.0:8082/structr/rest/Project
HTTP/1.1 200 OK
{
"result": [
{
"id": "d8070ae07cde4b6d9d6302acb6115e91",
"type": "Project",
"name": "Test"
},
{
"id": "9f040115a5744526801a6b1f733b2de6",
"type": "Project",
"name": "Project 1"
},
{
"id": "7159a1e615f240ada4f160ea7e3280b8",
"type": "Project",
"name": "Important Project"
}
],
"query_time": "0.000043672",
"result_count": 3,
"page_count": 1,
"result_count_time": "0.000098360",
"serialization_time": "0.000535650"
}

admin@Structr>

post

admin@Structr> post /Project { name: "Project Two" }
POST http://0.0.0.0:8082/structr/rest/Project
HTTP/1.1 201 Created
{
"result": [
"61e5023298924ba78113902a224d7eab"
],
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000103878",
"serialization_time": "0.000418174"
}
admin@Structr>

Result

$ curl -HX-User:admin -HX-Password:admin http://localhost:8082/structr/rest/Project?sort=name
{
"result": [
{
"name": "Project #1",
"type": "Project",
"id": "46b4cbfce4624f4a98578148229b77c2",
"description": "My first project",
"tasks": []
},
{
"name": "Project #2",
"type": "Project",
"id": "897a3ad3b2b8441f898d41a1179a06b7",
"description": "Another project",
"tasks": [
{
"id": "960f8b7acde14528a14bdcc812500eef",
"type": "Task",
"name": "Task #1"
},
{
"id": "0ea250b7743b46ed9b7e24411caafe06",
"type": "Task",
"name": "Task #2"
}
]
}
],
"query_time": "0.000090662",
"result_count": 2,
"page_count": 1,
"result_count_time": "0.000092554",
"serialization_time": "0.000454289"
}

Response

{
"result": [
{
"id": "c624511baa534ece9678f9d212711a9d",
"type": "Project",
"name": "Project #1"
},
{
"id": "85889e5ff1cd4bb39dc32076516504ce",
"type": "Project",
"name": "Project #2"
}
],
"query_time": "0.000026964",
"result_count": 2,
"page_count": 1,
"result_count_time": "0.000076108",
"serialization_time": "0.000425659"
}
{
"result": [
"46b4cbfce4624f4a98578148229b77c2"
],
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000333649",
"serialization_time": "0.001035385"
}

Result

$ curl -HX-User:admin -HX-Password:admin http://localhost:8082/structr/rest/Project/46b4cbfce4624f4a98578148229b77c2
{
"result": {
"name": "Project #1",
"type": "Project",
"id": "46b4cbfce4624f4a98578148229b77c2",
"description": "My first project"
},
"query_time": "0.004160732",
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000097147",
"serialization_time": "0.000428520"
}

Entity Resources

POST http://localhost:8082/structr/rest/Project
Body:
{
"name": "Testproject",
"projectId": "1"
}
Result:
{
"result": "c0546a30a79749aeaf364925388e8b60",
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000068591",
"serialization_time": "0.000299885"
}

Authentication Headers

$ curl -s -HX-User:admin -HX-Password:admin http://localhost:8082/structr/rest/Project
{
"result": [
{
"id": "362cc05768044c7db886f0bec0061a0a",
"type": "Project",
"name": "Project #1"
}
],
"query_time": "0.000035672",
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000114435",
"serialization_time": "0.001253579"
}

Default View (public)

{
"result": [
{
"id": "d46a2d3b90c94e368a70bc30acd30572",
"type": "Project",
"name": "Project #1"
},
{
"id": "6941a2af4c024b429ffc4851b404af72",
"type": "Project",
"name": "Project #2"
},
{
"id": "8db88530ea5949ba89cef1234e04d8e4",
"type": "Project",
"name": "Project #3"
}
],
"query_time": "0.000122986",
"result_count": 3,
"page_count": 1,
"result_count_time": "0.000062350",
"serialization_time": "0.017995394"
}

Manual View Selection (info)

{
"result": [
{
"id": "d46a2d3b90c94e368a70bc30acd30572",
"type": "Project",
"name": "Project #1",
"tasks": [
{
"id": "4a6894302db74c94b989fcac7e68a38e",
"name": "Task #1",
"type": "Task"
}
],
"description": "This is the description of the first project.",
"owner": null,
"priority": 2
},
{
"id": "6941a2af4c024b429ffc4851b404af72",
"type": "Project",
"name": "Project #2",
"tasks": [],
"description": "My second project.",
"owner": null,
"priority": 3
},
{
"id": "8db88530ea5949ba89cef1234e04d8e4",
"type": "Project",
"name": "Project #3",
"tasks": [],
"description": "Third project description.",
"owner": null,
"priority": 1
}
],
"query_time": "0.000159363",
"result_count": 3,
"page_count": 1,
"result_count_time": "0.000065976",
"serialization_time": "0.004041883"
}

Response

{
"result": [
"b0f7e79a17c649a9934687554990acd5"
],
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000048183",
"serialization_time": "0.000224176"
}
{
"result": [
"c431c1b5020f4430808f9b330a123159",
"4384f4685a4a41d09d4cfa1cb34c3024",
"011c26a452e24af0a3973862a305907c"
],
"result_count": 3,
"page_count": 1,
"result_count_time": "0.000038485",
"serialization_time": "0.000152850"
}

Fetching an object by UUID

{
"result": {
"id": "c431c1b5020f4430808f9b330a123159",
"type": "Project",
"name": "New Project 2"
},
"query_time": "0.000851438",
"result_count": 1,
"page_count": 1,
"result_count_time": "0.000054867",
"serialization_time": "0.000185543"
}