ManagementClient
definition when using an SDK).
After making the request, you’ll get a JSON response like this:
{
"id": "f15799a1-dff0-5216-a014-e963f9ea6bbc",
"codename": "cafe",
"last_modified": "2019-10-08T12:47:27.4261844Z",
"external_id": "cafe",
"name": "Cafe",
"content_groups": [],
"elements": [
{
"name": "Price per unit",
"guidelines": null,
"is_required": false,
"type": "number",
"id": "965cf18c-998a-456b-bee3-91defdf39782",
"codename": "price_per_unit"
},
{
"guidelines": "<h2>Keep Guidelines where the creative process happens.</h2>\n<p>These are sample guidelines that you can place for the whole content item. It’s a place where you can include your content brief, voice and tone recommendations or the URL to a wireframe, so the author will have all the relevant instructions at hand before writing a single line.</p>\n<p>Besides overview guidelines, you can include instructions for each particular content element, as you will see below.</p>",
"type": "guidelines",
"id": "8816e7d0-ca5e-4cfa-88b4-c1944862ff9f",
"codename": "n8e317a38_e3bc_4d98_a63d_f1e336c5a9e6"
},
{
"maximum_text_length": null,
"name": "Street",
"guidelines": null,
"is_required": false,
"type": "text",
"id": "2b7b256c-73cc-4be0-b749-4c410209df02",
"codename": "street"
},
{
"maximum_text_length": null,
"name": "City",
"guidelines": null,
"is_required": false,
"type": "text",
"id": "fa17f73a-833c-4cf2-aa7b-3b5c4edad6b3",
"codename": "city"
},
{
"maximum_text_length": null,
"name": "Country",
"guidelines": null,
"is_required": false,
"type": "text",
"id": "2b36b05e-5f4f-4630-b502-154f5b3b90c3",
"codename": "country"
},
{
"maximum_text_length": null,
"name": "State",
"guidelines": null,
"is_required": false,
"type": "text",
"id": "3638f2cd-3fea-4a4e-a6b6-bdd39f3b9f66",
"codename": "state"
},
{
"maximum_text_length": null,
"name": "ZIP Code",
"guidelines": null,
"is_required": false,
"type": "text",
"id": "35ad677a-cfe5-4573-814d-5895e3de8396",
"codename": "zip_code"
},
{
"maximum_text_length": null,
"name": "Phone",
"guidelines": null,
"is_required": false,
"type": "text",
"id": "4ec54355-4177-4b29-9a16-b25a7c8fba26",
"codename": "phone"
},
{
"maximum_text_length": null,
"name": "Email",
"guidelines": null,
"is_required": false,
"type": "text",
"id": "9bc4b679-4353-40c7-bcfd-145110ced7d9",
"codename": "email"
},
{
"asset_count_limit": null,
"maximum_file_size": null,
"allowed_file_types": "any",
"image_width_limit": null,
"image_height_limit": null,
"name": "Photo",
"guidelines": null,
"is_required": false,
"type": "asset",
"id": "1693ecd3-fb15-4d56-975a-4b8dbdedf65b",
"codename": "photo"
}
]
}
// Tip: Find more about .NET SDKs at https://kontent.ai/learn/net
using Kontent.Ai.Management;
var client = new ManagementClient(new ManagementOptions
{
ApiKey = "<YOUR_API_KEY>",
ProjectId = "<YOUR_ENVIRONMENT_ID>"
});
var response = await client.CreateContentTypeAsync(new ContentTypeCreateModel
{
Codename = "cafe",
Name = "Cafe",
ExternalId = "cafe",
Elements = new ElementMetadataBase[]
{
new NumberElementMetadataModel
{
Name = "Price per uni",
Codename = "price_per_unit",
},
new GuidelinesElementMetadataModel
{
Guidelines = "<h2>Keep Guidelines where the creative process happens.</h2>\n<p>These are sample guidelines that you can place for the whole content item. It’s a place where you can include your content brief, voice and tone recommendations or the URL to a wireframe, so the author will have all the relevant instructions at hand before writing a single line.</p>\n<p>Besides overview guidelines, you can include instructions for each particular content element, as you will see below.</p>",
Codename = "n2f836bce_e062_b2cd_5265_f5c3be3aa6f5",
},
new TextElementMetadataModel
{
Name = "Street",
ExternalId = "street",
},
new TextElementMetadataModel
{
Name = "City",
ExternalId = "city",
},
new TextElementMetadataModel
{
Name = "Country",
ExternalId = "country",
},
new TextElementMetadataModel
{
Name = "State",
ExternalId = "state",
},
new TextElementMetadataModel
{
Name = "ZIP code",
ExternalId = "zip_code",
},
new TextElementMetadataModel
{
Name = "Email",
ExternalId = "email",
},
new TextElementMetadataModel
{
Name = "Phone",
ExternalId = "phone",
},
new AssetElementMetadataModel
{
Name = "Photo",
Codename = "photo"
}
}
});