TM1 Rest API – CRUD App – 3rd Chapter
In this chapter we are going to discuss on update and delete operation of rest API. Among PUT/POST/Patch, based on the resource and operation type either one can be used. There are lots of online articles which talk about the uniqueness of each operation and their differences.?In our application a post operation is used to update an existing object for example: in a tm1 chore if we would like to update the active flag, we will send a post command
The web application has activate/deactivate button based on the current active flag value as shown below in chore-detail.js
If the chore is already in active state – the deactivate button will be enabled and vice versa. Also, the below code in chore-details.js show the activate functionality. It is same for deactivate expect for the url (at the end it will have tm1.Deactivate)?
The application will look as below based on the current state
Delete
The Delete rest api operation is called from the trash button (all buttons are free version from fontawesome website)
The onclick event calls an event function removeClicked when then calls the deleteChore in api-service.js (similar to createChore)
Links to - 1st Chapter , 2nd Chapter and 4th Chapter