Skip to main content Skip to complementary content

Reading a data model using the API

You can retrieve the data model using its name. The response includes technical information about the data model attributes so that you can update the data model.

In this example, Talend API Tester is used to send requests.

For further information about Talend API Tester, see Talend Cloud API Tester User Guide.

Procedure

  1. If you do not have a personal access token yet, generate one. For further information, see Generating a Personal Access Token.
  2. Open Talend API Tester in your browser.
  3. From the Repository tab, select Get in the Method drop-down list.
  4. Enter the following URL: https://tds.{region}.cloud.talend.com/schemaservice/api/v1/schemas/org.talend.schema/{dataModelName}
    You'll find a list of the URLs to use for each data center in Accessing Talend Cloud applications.

    {dataModelName} is the data model's technical name and not the name displayed in the list of data models in Talend Cloud Data Stewardship. For example, my_products_created_via_API used in Creating a data model using the API.

  5. Click the Add header button and enter Authorization in the name field and Bearer followed by a whitespace and your token in the value field.
  6. Click the Add header button and enter Cookie in the name field, then leave the value field empty.
  7. Click Send.

Results

The API returns a 200 HTTP code to inform you that the request was successful. The response includes a JSON description of the data model attributes, for example:
{
    "namespace": "org.talend.schema",
    "displayName": "Product (created via API)",
    "name": "my_products_created_via_API",
    "description": "Product catalog available.",
    "version": 1,
    "references": null,
    "creationDate": 1601467434441,
    "lastUpdateDate": 1601467434441,
    "createdBy":{
        "id": "3e2eed7d-c632-40da-822e-9780f2c74842",
        "username": "user@account",
        "firstName": "user",
        "lastName": "name",
        "enabled": true
    },
    "lastUpdatedBy": {
        "id": "3e2eed7d-c632-40da-822e-9780f2c74842",
        "username": "user@account",
        "firstName": "user",
        "lastName": "name",
        "enabled": true
    },
    "fields": [{
        "uuid": "333ca858-5083-4425-bf36-c4fb3c259550",
        "name": "Id",
        "displayName": "Id",
        "path": null,
        "type": "integer",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "fef4318c-b859-45ce-a454-06cd3ded3389",
        "name": "Name",
        "displayName": "Name",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "7fa67525-bd6d-4b69-ad5b-f515911d32a6",
        "name": "Material",
        "displayName": "Material",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "7673756a-73e8-4c4f-b460-86cc27e938e7",
        "name": "Size",
        "displayName": "Size",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "1f358991-9c16-412a-88d4-75b99a3d1748",
        "name": "Price",
        "displayName": "Price",
        "path": null,
        "type": "decimal",
        "description": "",
        "required": true,
        "constraints": [{
            "name": "scaleDecimal",
            "value": "2"
        }],
        "allowedValues": null
    }, {
        "uuid": "c933a4d6-3ce5-4548-99fe-102313ef47e4",
        "name": "Quantity",
        "displayName": "Quantity",
        "path": null,
        "type": "integer",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "dcd1b06f-2545-45f5-a94f-4f8ddbfc35b7",
        "name": "Family",
        "displayName": "Family",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "9bf5f4b2-7454-423d-a2e7-3a41de740927",
        "name": "Packaging",
        "displayName": "Packaging",
        "path": null,
        "type": "text",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "48678877-8401-47d8-93d9-2097fe0df3c0",
        "name": "ProductURL",
        "displayName": "Product URL",
        "path": null,
        "type": "URL",
        "description": "",
        "required": true,
        "constraints": [],
        "allowedValues": null
    }, {
        "uuid": "737ea048-de9c-414b-9052-904ad8ed316a",
        "name": "productType",
        "displayName": "Type",
        "path": null,
        "type": "text",
        "description": "",
        "required": false,
        "constraints": [],
        "allowedValues": null
    }],
    "referenced": true
}
Information noteNote: If you try to retrieve a data model with a name that does not exist, the API returns a 404 Not Found error. The response includes a message like this one:
"code":"SCHEMA_ALL_SCHEMA_NOT_FOUND","message":"SCHEMA_NOT_FOUND","context":{"namespace":"org.talend.schema","name":"demo_produc"}}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!