Admin - Clone Objects API

Controls cloning supported objects and viewing cloning job status.

A Clone Object is an association between a Source and a Destination; it also tracks the current state of a clone operation and any errors that may have occurred during the job.

Interfaces

Object Synopses

CloneObjectRequest

  • source_id Integer

    The id of the source object

  • source_type String

    The type of the source object

  • options Object

    Additional fields to be applied to the new object

CloneObjectResponse

  • id Integer

    Clone Object id

  • state String

    Current state of the cloning operation

  • destination_id Integer

    The id of the destination object

  • destination_type String

    The type of the destination object

  • source_id Integer

    The id of the source object

  • source_type String

    The type of the source object

  • error_messages Array

    An array of any existing error messages

  • created_at String

    The date the clone object was created

  • updated_at String

    The date the clone object was last updated

List Clone Objects

GET /api/admin/clone_objects

Response Codes

  • 200 OK
  • 304 Not Modified

{ "meta": {}, "clone_objects": [ { "id": 3, "state": "created", "destination_id": 1605, "destination_type": "SubAccount", "source_id": 1, "source_type": "SubAccount", "error_messages": [], "created_at": "2018-03-28T15:36:16.915-06:00", "updated_at": "2018-03-28T15:36:16.915-06:00", "parameters": { "subdomain": "sub-clone-1" , "name": "Sub Clone 1" } } ] }

Show a clone object

GET /api/admin/clone_objects/:id

Response Codes

  • 200 OK

Parameters

  • id Integer Required

    Path parameter. Clone Object id

Example Response

{
  "clone_objects": [
    {
      "id": 3,
      "state": "created",
      "destination_id": 1605,
      "destination_type": "SubAccount",
      "source_id": 1,
      "source_type": "SubAccount",
      "error_messages": [],
      "created_at": "2018-03-28T15:36:16.915-06:00",
      "updated_at": "2018-03-28T15:36:16.915-06:00",
      "parameters": { "subdomain": "sub-clone-1" , "name": "Sub Clone 1" }
    }
  ]
}

Create Clone Objects

POST /api/admin/clone_objects

This will create a clone object and initiate a clone job for the requested object. Note that all source_types need to be identical. This endpoint does not support creating clone_objects for different source types at this time.

Response Codes

  • 201 Created
  • 400 Bad Request
  • 409 Conflict

Parameters

  • clone_objects CloneObjectRequest[] Required

    Body parameter. An array of {API::CloneObjectRequest} to be executed.

Example Request

{
  "clone_objects": [
    {
      "source_id": 1,
      "source_type": "SubAccount",
      "options": {
        "subdomain": "sub-clone-1",
        "name": "Sub Clone 1"
      }
    },
    {
      "source_id": 3,
      "source_type": "SubAccount",
      "options": {
        "subdomain": "sub-clone-2",
        "name": "Sub Clone 2"
      }
    }
  ]
}
curl \
  -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"clone_objects":[{"source_id":1,"source_type":"SubAccount","options":{"subdomain":"sub-clone-1","name":"Sub Clone 1"}},{"source_id":3,"source_type":"SubAccount","options":{"subdomain":"sub-clone-2","name":"Sub Clone 2"}}]}' \
  http://<bridge>/api/admin/clone_objects
    

Example Response

{
  "clone_objects": [
    {
      "id": 3,
      "state": "pending",
      "destination_id": 1605,
      "destination_type": "SubAccount",
      "source_id": 1,
      "source_type": "SubAccount",
      "error_messages": [],
      "created_at": "2018-03-28T15:36:16.915-06:00",
      "updated_at": "2018-03-28T15:36:16.915-06:00",
      "parameters": { "subdomain": "sub-clone-1" , "name": "Sub Clone 1" }
    },
    {
      "id": 4,
      "state": "pending",
      "destination_id": 1606,
      "destination_type": "SubAccount",
      "source_id": 3,
      "source_type": "SubAccount",
      "error_messages": [],
      "created_at": "2018-03-28T15:36:26.013-06:00",
      "updated_at": "2018-03-28T15:36:26.013-06:00",
      "parameters": { "subdomain": "sub-clone-2" , "name": "Sub Clone 2" }
    }
  ]
}