From the course: iOS App Development: RESTful Web Services

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Delete request

Delete request - iOS Tutorial

From the course: iOS App Development: RESTful Web Services

Start my 1-month free trial

Delete request

- [Instructor] Now that we've looked at three of the four CRUD operations, let's look at the last one for deleting an object off of a server. It's very similar to update in that we need to include the ID of the object that we're deleting. We'll do that in the URL. Also, like the other requests, we'll have to specify the HTTP method to be specific for the delete and in this case it's the word delete. So let's look at how that would play out in the code. So we can copy and paste the update server code since it includes the ID and the URL that were created. So we'll copy lines 54 to 65, just under it at line 67. We'll change the name of the function to delete from server and our URL already includes the ID and the string interpolation for the GUID. Now just to polish this off, we might want to add a guard statement here to make sure that the self.guid is not nil. Otherwise, we can return or handle the situation otherwise. The same exact guard would work in our update server call since…

Contents