Copy / Move

Copying an object

To copy a content object send a POST request to the /@copy endpoint at the destinations url with the source object specified in the request body. The source object can be specified either by url, path, UID or intid.

http

POST /plone/@copy HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json

{
    "source": "http://localhost:55001/plone/front-page"
}

curl

curl -i -X POST http://nohost/plone/@copy -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"source": "http://localhost:55001/plone/front-page"}' --user admin:secret

httpie

echo '{
  "source": "http://localhost:55001/plone/front-page"
}' | http POST http://nohost/plone/@copy Accept:application/json Content-Type:application/json -a admin:secret

python-requests

requests.post('http://nohost/plone/@copy', headers={
    'Accept': 'application/json',
    'Content-Type': 'application/json',
}, json={
    'source': 'http://localhost:55001/plone/front-page',
}, auth=('admin', 'secret'))

If the copy operation succeeds, the server will respond with status 200 (OK) and return the new and old url of the copied object.

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "source": "http://localhost:55001/plone/front-page", 
    "target": "http://localhost:55001/plone/copy_of_front-page"
  }
]

Moving an object

To move a content object send a POST request to the /@move endpoint at the destinations url with the source object specified in the request body. The source object can be specified either by url, path, UID or intid.

http

POST /plone/folder/@move HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json

{
    "source": "http://localhost:55001/plone/front-page"
}

curl

curl -i -X POST http://nohost/plone/folder/@move -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"source": "http://localhost:55001/plone/front-page"}' --user admin:secret

httpie

echo '{
  "source": "http://localhost:55001/plone/front-page"
}' | http POST http://nohost/plone/folder/@move Accept:application/json Content-Type:application/json -a admin:secret

python-requests

requests.post('http://nohost/plone/folder/@move', headers={
    'Accept': 'application/json',
    'Content-Type': 'application/json',
}, json={
    'source': 'http://localhost:55001/plone/front-page',
}, auth=('admin', 'secret'))

If the move operation succeeds, the server will respond with status 200 (OK) and return the new and old url of the moved object.

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "source": "http://localhost:55001/plone/front-page", 
    "target": "http://localhost:55001/plone/folder/front-page"
  }
]

Copying/moving multiple objects

Multiple objects can be moved/copied by giving a list of sources.

http

POST /plone/@copy HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Content-Type: application/json

{
    "source": [
        "http://localhost:55001/plone/front-page",
        "http://localhost:55001/plone/newsitem"
    ]
}

curl

curl -i -X POST http://nohost/plone/@copy -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"source": ["http://localhost:55001/plone/front-page", "http://localhost:55001/plone/newsitem"]}' --user admin:secret

httpie

echo '{
  "source": [
    "http://localhost:55001/plone/front-page",
    "http://localhost:55001/plone/newsitem"
  ]
}' | http POST http://nohost/plone/@copy Accept:application/json Content-Type:application/json -a admin:secret

python-requests

requests.post('http://nohost/plone/@copy', headers={
    'Accept': 'application/json',
    'Content-Type': 'application/json',
}, json={
    'source': ['http://localhost:55001/plone/front-page', 'http://localhost:55001/plone/newsitem'],
}, auth=('admin', 'secret'))

If the operation succeeds, the server will respond with status 200 (OK) and return the new and old urls for each copied/moved object.

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "source": "http://localhost:55001/plone/front-page", 
    "target": "http://localhost:55001/plone/copy_of_front-page"
  }, 
  {
    "source": "http://localhost:55001/plone/newsitem", 
    "target": "http://localhost:55001/plone/copy_of_newsitem"
  }
]