From TODO.txt:
I want to leave out the remote saving out of the Deploy module. We should
only care about the UUID and skip the whole cross communication to figure out
the remote IDs that happened in Deploy 6.x. So it's up to the remote to save
its entities based on the UUID. So we need to create a new module called
'services_uuid_entity'. That module will expose a REST service that saves
entities based on their UUID. The mapping is done locally on the site. And
for this to work the UUID module needs a function called 'uuid_entity_save()'
that can save entities based on their UUID. That function might need to be
abstracted to it's own module to depend on the Entity API module that
provides the proper 'entity_save()'.
So, the plan is to let the remote handle the content id mapping based on UUIDs?
While it sounds very nice, there are some problems I see in this approach:
1. You need this functionality implemented on the remote.
We'd need to write a plugin / module for every system we wanted to use and not only a REST / XMLRPC / ... Interface.
(Drupal, Wordpress, Yoomla, ...)
2. You need the full control over the remote to install the functionality.
We'd need to install the plugin / module.
3. It is not restful, as you can't decide whether it's an create or an update
- Create should issue something like: POST http://example.org/rest/node & data
- Updateshould issue something like: PUT http://example.org/rest/node/{nid} & data
That means we can't use other systems that implement a REST Interface without implementing a mapping mechanisme first and we can't use public APIs like Flickr or Youtube which require us to distinguish between a POST request for creating content and a PUT request for updating content.
My suggestion is to keep the local <-> remote id mapping in deploy itself as this reduces the dependencies on the remote and enables us to deploy to public APIs aswell.
Comments
Comment #1
sanduhrsI'd also like to be able to track where content has been successfully deployed to.
Comment #2
katbailey commentedJust regarding your 3rd point above, it is incorrect to say that this is not RESTful - I have not come across any definition of RESTful web services that stipulates the use of POST for resource creation and PUT for updates. If you look at the HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6), it sounds like the HTTP PUT method is exactly what we need here, i.e. in the case where we don't know if we are creating or updating:
The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.
Comment #3
sanduhrsWell, you are absolutely right in terms of the RFC and my statement to restfullness.
But the real world implementations are often different.
Using Flickr as example the upload [1] is a simple POST request
This would return:
<photoid>1234</photoid>To replace [2] (update) a photo we'd need to supply the photoid and issue a different POST request
So, to update / change / replace a Photo on Flickr we need to track the remote ids.
[1] http://www.flickr.com/services/api/upload.api.html
[2] http://www.flickr.com/services/api/replace.api.html