The first step in this example is to create a story.
1. Create the story with identifier story01. The handle is 1 because the CreateObject method applies at app level.
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "CreateObject",
"handle": 1,
"params": [
{
"title": "A Story",
"description": "This is the story",
"qInfo": {
"qId": "story01",
"qType": "story"
},
"qChildListDef": {
"qData": {
"title": "/title",
"description": "/description",
"children": "/qChildListDef"
}
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 2
},
"qInfo": {
"qId": "story01",
"qType": "story"
}
},
"change": [
2
]
}
The story story01 is created and has 2 as a handle.
For more information, see the CreateObject method.
2. The second step is to create the first slide slide01 in the story story01.
The handle of the request is 2 because the slide must be added to the story story01 that has 2 as a handle.
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "CreateChild",
"handle": 2,
"params": [
{
"title": "Slide 01",
"description": "This is the slide 01",
"qInfo": {
"qId": "slide01",
"qType": "slide"
},
"qChildListDef": {
"qData": {
"title": "/title"
}
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 3
},
"qInfo": {
"qId": "slide01",
"qType": "slide"
}
},
"change": [
3
]
}
The slide slide01 is created in the story. The handle related to this slide is 3.
3. The third step is to create the second slide slide02 in the story. The handle of the request is 2 because the slide must be added to the story story01 that has 2 as a handle.
The client sends:
{
"jsonrpc": "2.0",
"id": 4,
"method": "CreateChild",
"handle": 2,
"params": [
{
"title": "Slide 02",
"description": "This is the slide 02",
"qInfo": {
"qId": "slide02",
"qType": "slide"
},
"qChildListDef": {
"qData": {
"title": "/title"
}
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 4
},
"qInfo": {
"qId": "slide02",
"qType": "slide"
}
},
"change": [
4
]
}
The slide slide02 is created in the story. The handle related to this slide is 4.
4. In this step, the goal is to list the slides in the story story01. The handle of the request is 2 because the goal is to get the layout of the story story01 that has 2 as a handle.
The client sends:
{
"jsonrpc": "2.0",
"id": 5,
"method": "GetLayout",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 5,
"result": {
"qLayout": {
"qInfo": {
"qId": "story01",
"qType": "story"
},
"qSelectionInfo": {},
"title": "A Story",
"description": "This is the story",
"qChildList": {
"qItems": [
{
"qInfo": {
"qId": "slide01",
"qType": "slide"
},
"qData": {
"title": "Slide 01",
"description": "This is the slide 01",
"children": {
"qData": {
"title": "/title"
}
}
}
},
{
"qInfo": {
"qId": "slide02",
"qType": "slide"
},
"qData": {
"title": "Slide 02",
"description": "This is the slide 02",
"children": {
"qData": {
"title": "/title"
}
}
}
}
]
}
}
}
}
The story story01 contains two slides slide01 and slide02. The slides are listed in qChildList. The first slide in the story is the slide slide01.
5. In this step, the goal is to invert the order of the slides. The handle of the request is 2 because the story has 2 as a handle.
The slide slide02 should be the first slide in the story.
The client sends:
{
"jsonrpc": "2.0",
"id": 6,
"method": "SetChildArrayOrder",
"handle": 2,
"params": [
[
"slide02",
"slide01"
]
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 6,
"result": {},
"change": [
2
]
}
The slide slide02 becomes the first slide in the story.
6.List the slides in the story story01 to check that the order of the slides in the story is modified.
The client sends:
{
"jsonrpc": "2.0",
"id": 7,
"method": "GetLayout",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 7,
"result": {
"qLayout": {
"qInfo": {
"qId": "story01",
"qType": "story"
},
"qSelectionInfo": {},
"title": "A Story",
"description": "This is the story",
"qChildList": {
"qItems": [
{
"qInfo": {
"qId": "slide02",
"qType": "slide"
},
"qData": {
"title": "Slide 02",
"description": "This is the slide 02",
"children": {
"qData": {
"title": "/title"
}
}
}
},
{
"qInfo": {
"qId": "slide01",
"qType": "slide"
},
"qData": {
"title": "Slide 01",
"description": "This is the slide 01",
"children": {
"qData": {
"title": "/title"
}
}
}
}
]
}
}
}
}
The order of the slides is inverted. The first slide in qChildList is slide02. Previously, the first slide was slide01.