php - REST Resource vs Services -
i have created code make calls external api (that did not create). however, has been described 'service-centric', while rest apis 'resource-centric'.
what needs changed turn service based call? don't understand difference is. understand need use http verbs thought doing curl. possible curl?
the api have been passed contains bunch of resource urls example;
think of resources nouns, ie objects or records in database. think of actions verbs, ie function calls.
the first example indeed resource-centric. it's getting resource of type person identified 123.
the second example not resource-centric because it's function call. rest , http establish conventions saving resource. in case need put resource's url, ie same url retrieved get.
so upload json (or whatever format) using:
put http://api.privateservice.com/person?id=123
if passing in few attributes, not whole resource, there's standard that, patch:
patch http://api.privateservice.com/person?id=123
btw it's bit cleaner use http://api.privateservice.com/people/123
url.
Comments
Post a Comment