Creating a Content Type

Creating a Content Type

Using the Administration API in combination with master key authentication you can create content types from your code.

You can create two kinds of content types in Telerik Platform:

After creating a content type you can continue to defining its fields. See Managing Content Type Fields Using the Administration API for more information.

In the Cloud

When creating content types, you can specify the following fields: Name and Title.

Request:
    POST https://api.everlive.com/v1/Metadata/Applications/your-app-id/Types/
Headers:
    Authorization  Masterkey your-master-key
    Content-Type: application/json
Payload - raw:
    { "Name": "SampleType", "Title": "Sample Title" }
Response:
    Status: 201 Created
    Content-Type: application/json
    {
    "Result": {
        "Id": "f177e0e0-c321-11e4-9c2f-ef9817043d24",
        "CreatedAt": "2015-03-05T10:25:28.048Z"
        }
    }
//Ajax request using jQuery
var object = {
    "Name": "SampleType",
    "Title": "Sample Title"
};

$.ajax({
    url: 'https://api.everlive.com/v1/Metadata/Applications/your-app-id/Types/',
    type: "POST",
    headers:
    {
        "Authorization" : "Masterkey your-master-key"
    },
    contentType: "application/json",
    data: JSON.stringify(object),
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
})

The next table lists the properties that you need to include in the request body.

Name Type Description
Name Text The name of the content type that will appear in Telerik Platform. Cannot contain spaces.
Example: BackendTypeName
Title Text (Optional) A user-friendly name that appears in the portal.
Example: Backend Type Name

From a Data Connector

Creating a content type mapped to a data table coming from a Data Connector allows you to manipulate the table data using your Telerik Platform backend.

Use the Types endpoint to create a content type from a Data Connector.

Request:
    POST https://api.everlive.com/v1/Metadata/Applications/your-app-id/Types
Headers:
    Content-Type: application/json
    Authorization: Masterkey your-master-key-here
Body:
    {
        "Name": "Customers",
        "Title" : "Customers",
        "DataLinkId": "data-link-id-here",
        "SourceTypeName": "source-type-name-here",
    }

Response:
    Status: 201 Created
    Content-Type: application/json
Body:
    {
        "Result":
        {
            "Id": "30bfdc11-dbcf-49f7-928e-eb08aa5a2c51",
            "CreatedAt": "2014-04-28T08:08:41.636Z"
        }
    }

The next table lists the properties that you need to include in the request body.

Name Type Description
Name Text The name of the content type that will appear in Telerik Platform. Cannot contain spaces.
Example: BackendTypeName
Title Text (Optional) A user-friendly name that appears in the portal.
Example: Backend Type Name
DataLinkId Id The id of the Data Connector of this type
SourceTypeName Text The name of the source type (the table name for relational databases).
Example: Customers

See Also


Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.