Redgate Data Modeler

Accessing Data

Redgate Data Modeler’s document-oriented API functionality allows users to easily fetch:

    1. Lists of models and SQL scripts as a document tree in the JSON format.
    2. A physical data model as an XML file or a corresponding SQL result.
    3. A logical data model as an XML file.
    4. An SQL script.
    5. A migration script.

Examples

All the following examples use the curl tool. We assumed there is a “$TOKEN” variable available, which stores the public token generated as described in an earlier section of this article. A “:” character in the user parameter (-u option) is intended.

You can use the following command to declare the “$TOKEN” variable:

export TOKEN="<token_value>"

Download a Document Tree

To fetch a document tree, we need to make a GET HTTPS request to https://datamodeler.redgate-platform.com/drive with the following HTTP headers:

    1. An accept header with a JSON mime type: Accept: application/json
    2. An authorization header with a username equal to $TOKEN and an empty password, in the following format: Authorization: Basic (base64($TOKEN:))

Here is the corresponding curl example:

curl  -u "$TOKEN:" -H "Accept: application/json" https://datamodeler.redgate-platform.com/drive
-----
Result:
{
  "documents": [
    {
    "name": "Logical Model Demo",
    "type": "logical model",
    "link": "https://datamodeler.redgate-platform.com/logical/model/logical-model-id-here"
    },
    {
    "name": "MySQL demo physical data model",
    "type": "physical model",
    "link": "https://datamodeler.redgate-platform.com/model/model-id-here"
    },
    {
    "name": "Sample SQL script",
    "type": "SQL script",
    "link": "https://datamodeler.redgate-platform.com/sql-editor/sql-script-id-here"
    }
  ]
}

The result is a JSON file with a list of the documents (logical and physical models, SQL scripts to which you have access) in your Redgate Data Modeler account. Please note that the link property is a valid document URL and can be used for further requests.


Didn't find what you were looking for?