Import content items
This lesson shows you how to import a single content item using Management API. In short, to import content, you define a content type for the imported content if it’s not created already. Then, you’ll create a new content item and add content to its variants.
1. Define a content type for the content item
Before importing your content, you need to define a content type for the items you want to import. The content type in this example is named Cafe (with the codename and external ID both as cafe) and contains a few elements. To add a content type, send a POST request with these properties:- The display name of the new content type.
- (Optional) The codename of the content type. If you don’t specify the codename, it will be generated from the content type’s display name. However, you can change the codename later.
- (Optional) The external ID can be used as a unique identifier to retrieve content from a different system. See more about how to use different identifiers.
- A set of the elements you want to have in your content type.
ManagementClient
definition when using an SDK).
{
"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"
}
]
}
2. Import content to a content item
Sign in with your Kontent.ai credentials or sign up for free to unlock the full lesson, track your progress, and access exclusive expert insights and tips!