You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using REST would mean that we need to effectively disable CrudManger that combines all changes into one or several requests but we would use REST way of doing it. For example, update operation in REST must be done on per-event basis:
PUT /rest/api/event/21
PUT /rest/api/event/22
PUT /rest/api/event/23
PUT /rest/api/event/24
to update 4 events with ids 21, 22, 21, 24. Data for events are in the body of requests. Similarly for DELETE
I am experimenting with the Scheduler Pro trial. My project needs to access a specific remote REST API service for events, resources and other data.
The REST API has its own structure, naming, request and response format. For instance, there is no 'success' entry, the data part is named 'records', the fields returned have names as set in the DB (not the default startDate/endDate, etc). See below for a brief description of the API.
So differences exist in many places from the structure of the requests/responses and naming to the way parameters/values are passed in both ways and so on. I assume that I have to use CrudManager with a lot of customization, so please point me to an example that is the most complete and relevant to my case. Any other advice would be welcome.
UPDATE: I was able to load data by customizing eventStore and resourceStore. The problem now is how to implement insert, update, delete given the specificities of the REST API (below).
Thanks in advance
Andreas Sakellariou
Description of the API
The same mechanism is used for any DB table. Filtering and other capabilities do exist but are not described below.
Let us assume that we have to schedule room usage by employees. To load all records from the db table 'events' the endpoint would be
GET /records/events
and the response (notice the array):
{
"records":[
{
"ID": 1,
"StartDT": "2018-03-05T20:12:56Z", // start of event
"FinishDT": "2018-03-05T20:12:56Z", // end of event
"EmployeeID": 121, //foreign key -Employees table
"RoomID": 1, // resource id
"EmployeeName: "Smith John",
.....
(other fields of various data types}
},
{
"ID": 2,
"StartDT": "2018-04-05T20:12:56Z", // start of event
"FinishDT": "2018-04-05T20:12:56Z", // end of event
"EmployeeID": 122, //foreign key -Employees table
"RoomID": 2, // resource id
"EmployeeName: "Smith Helen",
.....
(other fields of various data types}
}
]
}
To insert a record:
POST /records/events
``` with params passed in the body
{
"StartDT": "2018-04-05T10:13:33Z", // start of event
"FinishDT": "2018-04-07T00:10:12Z", // end of event
"EmployeeID": 133, //foreign key -Employees table
"RoomID": 2, // resource id
......
}
ID is not passed since it is auto-incremented by the RDBMS. The response is the number of the new ID.
To read a specific record ie with ID=221 the request would be
GET /records/events/221
{
"ID": 221,
"StartDT": "2019-03-05T20:12:56Z", // start of event
"FinishDT": "2019-03-05T20:12:56Z", // end of event
"RoomID": 3, // resource id
"EmployeeID": 125, //foreign key -Employees table
"EmployeeName: "Allen Mark",
.....
(other fields of various data types}
}
To update a specific record ie with ID=221 the endpoint would be
PUT /records/events/221
{
"StartDT": "2019-03-05T20:12:56Z", // start of event
"FinishDT": "2019-03-05T22:15:56Z", // end of event
"RoomID": 3, // resource id
"EmployeeID": 144, //foreign key -Employees table
.....
(other fields that need to be updated}
}
The number of rows affected is returned as the response (ie 1)
The text was updated successfully, but these errors were encountered:
Using REST would mean that we need to effectively disable CrudManger that combines all changes into one or several requests but we would use REST way of doing it. For example, update operation in REST must be done on per-event basis:
PUT /rest/api/event/21
PUT /rest/api/event/22
PUT /rest/api/event/23
PUT /rest/api/event/24
to update 4 events with ids 21, 22, 21, 24. Data for events are in the body of requests. Similarly for DELETE
DELETE /rest/api/event/21
DELETE /rest/api/event/22
DELETE /rest/api/event/23
DELETE /rest/api/event/24
to delete events with ids 21, 22, 23 and 24.
Forum post
Dear Bryntum team,
I am experimenting with the Scheduler Pro trial. My project needs to access a specific remote REST API service for events, resources and other data.
The REST API has its own structure, naming, request and response format. For instance, there is no 'success' entry, the data part is named 'records', the fields returned have names as set in the DB (not the default startDate/endDate, etc). See below for a brief description of the API.
So differences exist in many places from the structure of the requests/responses and naming to the way parameters/values are passed in both ways and so on. I assume that I have to use CrudManager with a lot of customization, so please point me to an example that is the most complete and relevant to my case. Any other advice would be welcome.
UPDATE: I was able to load data by customizing eventStore and resourceStore. The problem now is how to implement insert, update, delete given the specificities of the REST API (below).
Thanks in advance
Andreas Sakellariou
Description of the API
The same mechanism is used for any DB table. Filtering and other capabilities do exist but are not described below.
Let us assume that we have to schedule room usage by employees. To load all records from the db table 'events' the endpoint would be
and the response (notice the array):
To insert a record:
{
"StartDT": "2018-04-05T10:13:33Z", // start of event
"FinishDT": "2018-04-07T00:10:12Z", // end of event
"EmployeeID": 133, //foreign key -Employees table
"RoomID": 2, // resource id
......
}
GET /records/events/221
.....
(other fields of various data types}
}
PUT /records/events/221
.....
(other fields that need to be updated}
}
The text was updated successfully, but these errors were encountered: