Skip to main content
Kinetic Community

Export Trees

This web method is used to export trees and local routines for a specified source and group.  This allows trees to be moved from one Kinetic Task server to another, or for backup purposes.  This web method is the inverse of the Import Tree web method. The URL for this web method contains the export-trees action.

Details

HTTP Request

Method: GET

URL: /app/api/v1/export-trees

 

URL Parameters

This web method uses the HTTP Get method, so parameters must be passed in the URL.  

Since the parameter values will contain user entered data that may not be URL safe, all values must be encoded when building up the URL.

 

URL Parameter Name Description Required / Optional
source The name of the Source that the trees and local routines belong to. Required
sourceGroup The name of the Group that the trees and local routines belong to. Required
names A comma-separated string of tree and local routine names that should be exported.  If this parameter is not provided, all trees and local routines in the Source / Group combination will be exported. Optional

If the names parameter is not provided, ALL trees and local routines that belong to the source and sourceGroup parameters will be exported.  Otherwise, only trees and local routines that match the list of provided names will be exported.

 

Example:

/app/api/v1/export-trees?source=Kinetic%20Request&sourceGroup=IT%20Catalog%20%3E%20iPad

In this example, all trees belonging to the Source named "Kinetic Request" and the "IT Catalog > iPad" group will be exported.

 

Response Messages

A successful API response will contain a 200 response code and a JSON formatted response body.  The JSON response object will contain the following properties:

 

Response Property Description
message A message describing what Kinetic Task did with the API request.
trees A list of trees

 

Example response:

{
    "message": "Exported 2 trees."
    "trees": [
        {...},
        {...}
    ]
}

 

A failed API response will contain either a 400 or a 500 series response code based on the exception type, and a JSON formatted response body containing the exception message.  See the table below for the types of responses that may be encountered with this API web method.

 

Example of a failed request:

Response Code: 400

Response Body:

{
    "message": "Unknown source: Non Existent Source"
}

 

Response Codes

Response Code Reason
200 Successful request.
400 If there was a problem archiving any of the trees or local routines.
400 If any of the required URL parameters was not provided.
401 If a Basic Authentication header was provided, but the credentials were not valid.
403 If the source has any applied API policy rules, and one or more of the policy rules was violated.
500 If there was an unexpected server error.

 

Examples

Example - Simple

This is a simple example showing how to export all trees and local routines that match the source and sourceGroup parameters.  This example does not use any authorization, so no headers need to be provided.

 

Method: POST

URL: /app/api/v1/export-trees

URL Parameters:

  1. source - Playground
  2. sourceGroup - Testing

Full API URL: /app/api/v1/export-trees?source=Playground&sourceGroup=Testing

This example is attempting to export all trees and local routines from the Playground source and Testing group.  The names of trees are not specified, so all trees will be exported.

 

Response Code: 200

Response Body:

{
    "message": "Exported 2 trees.",
    "trees": [
        {
            "createdAt": "2014-09-15T19:12:23.330Z",
            "createdBy": "SYSTEM",
            "id": 45,
            "name": "Export Trees Example",
            "notes": "An example tree",
            "ownerEmail": "support@kineticdata.com",
            "source": {
                "name": "Playground"
            },
            "sourceGroup": "Testing",
            "status": "Active",
            "updatedAt": "2014-09-15T19:32:58.663Z",
            "updatedBy": "SYSTEM"
        },
        {
            "createdAt": "2014-09-15T19:12:25.150Z",
            "createdBy": "SYSTEM",
            "definitionId": "routine_playground_testing_v1",
            "id": 46,
            "name": "Export Routine Example",
            "notes": "An example routine",
            "ownerEmail": "support@kineticdata.com",
            "source": {
                "name": "Playground"
            },
            "sourceGroup": "Testing",
            "status": "Active",
            "updatedAt": "2014-09-15T19:32:58.663Z",
            "updatedBy": "SYSTEM"
        }
    ]
}