// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
// Using ES6 syntax
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: '<YOUR_ENVIRONMENT_ID>',
apiKey: '<YOUR_API_KEY>'
});
const response = client.addContentTypeSnippet()
.withData(builder => {
return {
name: "Metadata",
codename: "metadata",
elements: [
builder.textElement({
name: "Title",
codename: "title",
type: 'text'
}),
builder.textElement({
name: "Keywords",
codename: "keywords",
type: 'text'
}),
builder.textElement({
name: "Description",
codename: "description",
type: 'text'
})
]
};
})
.toPromise();
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
// Using ES6 syntax
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: '<YOUR_ENVIRONMENT_ID>',
apiKey: '<YOUR_API_KEY>'
});
const response = client.addTaxonomy()
.withData(
{
name: 'Blogpost topic',
codename: 'blog_topic',
terms: [
{
name: 'Sport',
codename: 'sport',
terms: [
{
name: 'Soccer',
codename: 'soccer',
terms: []
},
{
name: 'Ice hockey',
codename: 'hockey',
terms: []
},
{
name: 'Rugby',
codename: 'rugby',
terms: []
}
]
},
{
name: "Technology stack",
codename: "tech",
terms: [
{
name: "JavaScript",
codename: "js",
terms: []
},
{
name: "C#",
codename: "c",
terms: []
},
{
name: 'MVC',
codename: 'mvc',
terms: []
}
]
}
]
}
)
.toPromise();