Show / Hide Table of Contents

Class ContentfulManagementClient

Encapsulates methods to interact with the Contentful Management API.

Main class for interaction with the contentful management API.

To use it you need to provide an HttpClient as well as your management api key and space id. These can be provided through any of the constructors below.

var httpClient = new HttpClient();

var client = new ContentfulManagementClient(httpClient, "<management_api_key>", "<space_id>"); //provide your management api token and space id directly in the constructor.

var options = new ContentfulOptions() {
    DeliveryApiKey = "<delivery_api_key>",
    ManagementApiKey = "<management_api_key>",
    SpaceId = "<space_id>",
    UsePreviewApi = false,
    MaxNumberOfRateLimitRetries = 2
};

var clientWithOptions = new ContentfulClient(httpClient, options); //Using ContentfulOptions is the prefered approach as it allows you to specify both the management and the delivery api key as well as further options.

Note that the space id provided will be the default space used for all operations on the ContentfulManagementClient, but you can override that for any method call by providing another space id.

For ASP.NET Core applications the ContentfulManagementClient also supports the IOptions pattern where you can supply the constructor with an IOptions<ContentfulOptions>. This potentially lets you keep your authorization token in your application settings, in environment variables or your own custom Microsoft.Extensions.Configuration.IConfigurationSource provider.

Inheritance
System.Object
ContentfulClientBase
ContentfulManagementClient
Inherited Members
ContentfulClientBase._httpClient
ContentfulClientBase._options
ContentfulClientBase.SerializerSettings
ContentfulClientBase.Version
ContentfulClientBase.Application
ContentfulClientBase.CreateExceptionForFailedRequest(HttpResponseMessage)
ContentfulClientBase.SendHttpRequest(String, HttpMethod, String, CancellationToken, HttpContent, Nullable<Int32>, String, String, List<KeyValuePair<String, IEnumerable<String>>>)
ContentfulClientBase.AddVersionHeader(Nullable<Int32>, HttpRequestMessage)
ContentfulClientBase.EnsureSuccessfulResult(HttpResponseMessage)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace:Contentful.Core
Assembly:cs.temp.dll.dll
Syntax
public class ContentfulManagementClient : ContentfulClientBase, IContentfulManagementClient

Constructors

ContentfulManagementClient(HttpClient, ContentfulOptions)

Initializes a new instance of the ContentfulManagementClient class. The main class for interaction with the contentful deliver and preview APIs.

Declaration
public ContentfulManagementClient(HttpClient httpClient, ContentfulOptions options)
Parameters
Type Name Description
HttpClient httpClient

The HttpClient of your application.

ContentfulOptions options

The ContentfulOptions used for this client.

Exceptions
Type Condition
System.ArgumentException

The options parameter was null or empty

ContentfulManagementClient(HttpClient, String, String)

Initializes a new instance of the ContentfulManagementClient class.

Declaration
public ContentfulManagementClient(HttpClient httpClient, string managementApiKey, string spaceId)
Parameters
Type Name Description
HttpClient httpClient

The HttpClient of your application.

System.String managementApiKey

The management API key used when communicating with the Contentful API

System.String spaceId

The id of the space to fetch content from.

Methods

ActivateContentType(String, Int32, String, CancellationToken)

Activates a ContentType by the specified id.

Declaration
public Task<ContentType> ActivateContentType(string contentTypeId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String contentTypeId

The id of the content type.

System.Int32 version

The last known version of the content type.

System.String spaceId

The id of the space to activate the content type in. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentType>

The response from the API serialized into a ContentType.

Implements
IContentfulManagementClient.ActivateContentType(String, Int32, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The contentTypeId parameter was null or empty

ArchiveAsset(String, Int32, String, CancellationToken)

Archives an asset by the specified id.

Declaration
public Task<ManagementAsset> ArchiveAsset(string assetId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String assetId

The id of the asset to archive.

System.Int32 version

The last known version of the asset.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The ManagementAsset archived.

Implements
IContentfulManagementClient.ArchiveAsset(String, Int32, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The assetId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

ArchiveEntry(String, Int32, String, CancellationToken)

Archives an entry by the specified id.

Declaration
public Task<Entry<dynamic>> ArchiveEntry(string entryId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String entryId

The id of the entry.

System.Int32 version

The last known version of the entry.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The response from the API serialized into Entry<T>

Implements
IContentfulManagementClient.ArchiveEntry(String, Int32, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The entryId parameter was null or empty.

CreateApiKey(String, String, String, CancellationToken)

Creates an ApiKey in a space.

Declaration
public Task<ApiKey> CreateApiKey(string name, string description, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String name

The name of the API key to create.

System.String description

The description of the API key to create.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ApiKey>

The created ApiKey.

Implements
IContentfulManagementClient.CreateApiKey(String, String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateAsset(ManagementAsset, String, CancellationToken)

Creates an ManagementAsset with a randomly created id.

Declaration
public Task<ManagementAsset> CreateAsset(ManagementAsset asset, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
ManagementAsset asset

The asset to create.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The created ManagementAsset

Implements
IContentfulManagementClient.CreateAsset(ManagementAsset, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateEntry(Entry<Object>, String, String, CancellationToken)

Creates an Entry<T>.

Declaration
public Task<Entry<dynamic>> CreateEntry(Entry<dynamic> entry, string contentTypeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Entry<System.Object> entry

The entry to create or update.

System.String contentTypeId

The id of the ContentType of the entry.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The created Entry<T>.

Implements
IContentfulManagementClient.CreateEntry(Entry<Object>, String, String, CancellationToken)

CreateEntry<T>(T, String, String, CancellationToken)

Creates an entry.

Declaration
public Task<T> CreateEntry<T>(T entry, string contentTypeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
T entry

The object to create an entry from.

System.String contentTypeId

The id of the ContentType of the entry.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<T>

The created entry.

Type Parameters
Name Description
T
Implements
IContentfulManagementClient.CreateEntry<T>(T, String, String, CancellationToken)

CreateEntryForLocale(Object, String, String, String, String, CancellationToken)

Creates an entry with values for a certain locale from the provided object.

Declaration
public Task<Entry<dynamic>> CreateEntryForLocale(object entry, string id, string contentTypeId, string locale = null, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Object entry

The object to use as values for the entry fields.

System.String id

The of the entry to create.

System.String contentTypeId

The id of the content type to create an entry for.

System.String locale

The locale to set fields for. The default locale for the space will be used if this parameter is null or empty.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The created Entry<T>.

Implements
IContentfulManagementClient.CreateEntryForLocale(Object, String, String, String, String, CancellationToken)

CreateEnvironment(String, String, CancellationToken)

Creates a ContentfulEnvironment for a space.

Declaration
public Task<ContentfulEnvironment> CreateEnvironment(string name, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String name

The name of the environment.

System.String spaceId

The id of the space to create an environment in. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulEnvironment>

The created ContentfulEnvironment.

Implements
IContentfulManagementClient.CreateEnvironment(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The required arguments were not provided.

ContentfulException

There was an error when communicating with the Contentful API.

CreateExtension(UiExtension, String, CancellationToken)

Creates a UiExtension in a Space.

Declaration
public Task<UiExtension> CreateExtension(UiExtension extension, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
UiExtension extension

The UI extension to create.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<UiExtension>

The created UiExtension.

Implements
IContentfulManagementClient.CreateExtension(UiExtension, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateLocale(Locale, String, CancellationToken)

Creates a locale in the specified Space.

Declaration
public Task<Locale> CreateLocale(Locale locale, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Locale locale

The Locale to create.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Locale>

The created Locale.

Implements
IContentfulManagementClient.CreateLocale(Locale, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateManagementToken(ManagementToken, CancellationToken)

Creates a CMA management token that can be used to access the Contentful Management API.

Declaration
public Task<ManagementToken> CreateManagementToken(ManagementToken token, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
ManagementToken token

The token to create.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementToken>

The created ManagementToken.

Implements
IContentfulManagementClient.CreateManagementToken(ManagementToken, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateOrganizationMembership(String, String, String, Boolean, CancellationToken)

Creates a membership in an Organization.

Declaration
public Task<OrganizationMembership> CreateOrganizationMembership(string organizationId, string role, string email, bool suppressInvitation, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String organizationId

The id of the organization to create a membership in.

System.String role

The role the membership should have for that organization.

System.String email

The email address of the membership.

System.Boolean suppressInvitation

Whether or not to suppress the invitation email.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<OrganizationMembership>

The created OrganizationMembership.

Implements
IContentfulManagementClient.CreateOrganizationMembership(String, String, String, Boolean, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateOrUpdateAsset(ManagementAsset, String, Nullable<Int32>, CancellationToken)

Creates or updates an ManagementAsset. Updates if an asset with the same id already exists.

Declaration
public Task<ManagementAsset> CreateOrUpdateAsset(ManagementAsset asset, string spaceId = null, int? version = default(int? ), CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
ManagementAsset asset

The asset to create or update.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Nullable<System.Int32> version

The last known version of the entry. Must be set when updating an asset.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The updated ManagementAsset

Implements
IContentfulManagementClient.CreateOrUpdateAsset(ManagementAsset, String, Nullable<Int32>, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateOrUpdateContentType(ContentType, String, Nullable<Int32>, CancellationToken)

Creates or updates a ContentType. Updates if a content type with the same id already exists.

Declaration
public Task<ContentType> CreateOrUpdateContentType(ContentType contentType, string spaceId = null, int? version = default(int? ), CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
ContentType contentType

The ContentType to create or update. Remember to set the id property.

System.String spaceId

The id of the space to create the content type in. Will default to the one set when creating the client.

System.Nullable<System.Int32> version

The last version known of the content type. Must be set for existing content types. Should be null if one is created.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentType>

The created or updated ContentType.

Implements
IContentfulManagementClient.CreateOrUpdateContentType(ContentType, String, Nullable<Int32>, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

Thrown if the id of the content type is not set.

CreateOrUpdateEntry(Entry<Object>, String, String, Nullable<Int32>, CancellationToken)

Creates or updates an Entry<T>. Updates if an entry with the same id already exists.

Declaration
public Task<Entry<dynamic>> CreateOrUpdateEntry(Entry<dynamic> entry, string spaceId = null, string contentTypeId = null, int? version = default(int? ), CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Entry<System.Object> entry

The entry to create or update.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.String contentTypeId

The id of the ContentType of the entry. Need only be set if you are creating a new entry.

System.Nullable<System.Int32> version

The last known version of the entry. Must be set when updating an entry.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The created or updated Entry<T>.

Implements
IContentfulManagementClient.CreateOrUpdateEntry(Entry<Object>, String, String, Nullable<Int32>, CancellationToken)

CreateOrUpdateEntry<T>(T, String, String, String, Nullable<Int32>, CancellationToken)

Creates or updates an entry. Updates if an entry with the same id already exists.

Declaration
public Task<T> CreateOrUpdateEntry<T>(T entry, string id, string spaceId = null, string contentTypeId = null, int? version = default(int? ), CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
T entry

The entry to create or update.

System.String id

The id of the entry to create or update.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.String contentTypeId

The id of the ContentType of the entry. Need only be set if you are creating a new entry.

System.Nullable<System.Int32> version

The last known version of the entry. Must be set when updating an entry.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<T>

The created or updated entry.

Type Parameters
Name Description
T
Implements
IContentfulManagementClient.CreateOrUpdateEntry<T>(T, String, String, String, Nullable<Int32>, CancellationToken)

CreateOrUpdateEnvironment(String, String, Nullable<Int32>, String, CancellationToken)

Creates a ContentfulEnvironment for a space.

Declaration
public Task<ContentfulEnvironment> CreateOrUpdateEnvironment(string id, string name, int? version = default(int? ), string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String id

The id of the environment to create.

System.String name

The name of the environment to create.

System.Nullable<System.Int32> version

The last known version of the environment. Must be set when updating an environment.

System.String spaceId

The id of the space to create an environment in. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulEnvironment>

The created ContentfulEnvironment.

Implements
IContentfulManagementClient.CreateOrUpdateEnvironment(String, String, Nullable<Int32>, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The required arguments were not provided.

ContentfulException

There was an error when communicating with the Contentful API.

CreateOrUpdateExtension(UiExtension, String, Nullable<Int32>, CancellationToken)

Creates or updates a UI extension. Updates if an extension with the same id already exists.

Declaration
public Task<UiExtension> CreateOrUpdateExtension(UiExtension extension, string spaceId = null, int? version = default(int? ), CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
UiExtension extension

The UiExtension to create or update. Remember to set the id property.

System.String spaceId

The id of the space to create the content type in. Will default to the one set when creating the client.

System.Nullable<System.Int32> version

The last version known of the extension. Must be set for existing extensions. Should be null if one is created.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<UiExtension>

The created or updated UiExtension.

Implements
IContentfulManagementClient.CreateOrUpdateExtension(UiExtension, String, Nullable<Int32>, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

Thrown if the id of the content type is not set.

ContentfulException

There was an error when communicating with the Contentful API.

CreateOrUpdateWebhook(Webhook, String, CancellationToken)

Creates or updates a webhook in a Space. Updates if a webhook with the same id already exists.

Declaration
public Task<Webhook> CreateOrUpdateWebhook(Webhook webhook, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Webhook webhook

The webhook to create or update.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Webhook>

The created Webhook.

Implements
IContentfulManagementClient.CreateOrUpdateWebhook(Webhook, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The id of the webhook parameter was null or empty.

CreateRole(Role, String, CancellationToken)

Creates a role in a Space.

Declaration
public Task<Role> CreateRole(Role role, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Role role

The role to create.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Role>

The created Role.

Implements
IContentfulManagementClient.CreateRole(Role, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateSpace(String, String, String, CancellationToken)

Creates a new space in Contentful.

Declaration
public Task<Space> CreateSpace(string name, string defaultLocale, string organisation = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String name

The name of the space to create.

System.String defaultLocale

The default locale for this space.

System.String organisation

The organisation to create a space for. Not required if the account belongs to only one organisation.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Space>

The created Space

Implements
IContentfulManagementClient.CreateSpace(String, String, String, CancellationToken)

CreateSpaceMembership(SpaceMembership, String, CancellationToken)

Creates a membership in a Space.

Declaration
public Task<SpaceMembership> CreateSpaceMembership(SpaceMembership spaceMembership, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
SpaceMembership spaceMembership

The membership to create.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<SpaceMembership>

The created SpaceMembership.

Implements
IContentfulManagementClient.CreateSpaceMembership(SpaceMembership, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

CreateWebhook(Webhook, String, CancellationToken)

Creates a webhook in a Space.

Declaration
public Task<Webhook> CreateWebhook(Webhook webhook, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Webhook webhook

The webhook to create.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Webhook>

The created Webhook.

Implements
IContentfulManagementClient.CreateWebhook(Webhook, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

DeactivateContentType(String, String, CancellationToken)

Deactivates a ContentType by the specified id.

Declaration
public Task DeactivateContentType(string contentTypeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String contentTypeId

The id of the content type.

System.String spaceId

The id of the space to deactivate the content type in. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task

The response from the API serialized into a ContentType.

Implements
IContentfulManagementClient.DeactivateContentType(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The contentTypeId parameter was null or empty

DeleteApiKey(String, String, CancellationToken)

Deletes an api key by the specified id.

Declaration
public Task DeleteApiKey(string apiKeyId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String apiKeyId

The id of the api key to delete.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task

A SystemProperties with metadata of the upload.

Implements
IContentfulManagementClient.DeleteApiKey(String, String, CancellationToken)

DeleteAsset(String, Int32, String, CancellationToken)

Deletes an asset by the specified id.

Declaration
public Task DeleteAsset(string assetId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String assetId

The id of the asset to delete.

System.Int32 version

The last known version of the asset.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteAsset(String, Int32, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The assetId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

DeleteContentType(String, String, CancellationToken)

Deletes a ContentType by the specified id.

Declaration
public Task DeleteContentType(string contentTypeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String contentTypeId

The id of the content type.

System.String spaceId

The id of the space to delete the content type in. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task

The response from the API serialized into a ContentType.

Implements
IContentfulManagementClient.DeleteContentType(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The contentTypeId parameter was null or empty

DeleteEntry(String, Int32, String, CancellationToken)

Deletes a single entry by the specified id.

Declaration
public Task DeleteEntry(string entryId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String entryId

The id of the entry.

System.Int32 version

The last known version of the entry.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteEntry(String, Int32, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The entryId parameter was null or empty.

DeleteEnvironment(String, String, CancellationToken)

Deletes a ContentfulEnvironment for a space.

Declaration
public Task DeleteEnvironment(string id, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String id

The id of the environment to delete.

System.String spaceId

The id of the space to get an environment in. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteEnvironment(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The required arguments were not provided.

ContentfulException

There was an error when communicating with the Contentful API.

DeleteExtension(String, String, CancellationToken)

Deletes a UiExtension by the specified id.

Declaration
public Task DeleteExtension(string extensionId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String extensionId

The id of the extension.

System.String spaceId

The id of the space to delete the extension in. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteExtension(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The contentTypeId parameter was null or empty

DeleteLocale(String, String, CancellationToken)

Deletes a locale by the specified id.

Declaration
public Task DeleteLocale(string localeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String localeId

The id of the locale to delete.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteLocale(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The localeId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

DeleteOrganizationMembership(String, String, CancellationToken)

Deletes a OrganizationMembership for a space.

Declaration
public Task DeleteOrganizationMembership(string membershipId, string organizationId, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String membershipId

The id of the organization membership to delete.

System.String organizationId

The id of the organization.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteOrganizationMembership(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The membershipId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

DeleteRole(String, String, CancellationToken)

Deletes a role by the specified id.

Declaration
public Task DeleteRole(string roleId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String roleId

The id of the role to delete.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteRole(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The roleId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

DeleteSpace(String, CancellationToken)

Deletes a space in Contentful.

Declaration
public Task DeleteSpace(string id, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String id

The id of the space to delete.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteSpace(String, CancellationToken)

DeleteSpaceMembership(String, String, CancellationToken)

Deletes a SpaceMembership for a space.

Declaration
public Task DeleteSpaceMembership(string spaceMembershipId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceMembershipId

The id of the space membership to delete.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteSpaceMembership(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The spaceMembershipId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

DeleteUpload(String, String, CancellationToken)

Gets an upload SystemProperties by the specified id.

Declaration
public Task DeleteUpload(string uploadId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String uploadId

The id of the uploaded file.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task

A SystemProperties with metadata of the upload.

Implements
IContentfulManagementClient.DeleteUpload(String, String, CancellationToken)

DeleteWebhook(String, String, CancellationToken)

Deletes a webhook from a Space.

Declaration
public Task DeleteWebhook(string webhookId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String webhookId

The id of the webhook to delete.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.DeleteWebhook(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The webhookId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetActivatedContentTypes(String, CancellationToken)

Get all activated content types of a space.

Declaration
public Task<IEnumerable<ContentType>> GetActivatedContentTypes(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space to get the activated content types of. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ContentType>>

An System.Collections.Generic.IEnumerable<T> of ContentType.

Implements
IContentfulManagementClient.GetActivatedContentTypes(String, CancellationToken)

GetAllApiKeys(String, CancellationToken)

Gets a collection of all ApiKey in a space.

Declaration
public Task<ContentfulCollection<ApiKey>> GetAllApiKeys(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<ApiKey>>

A ContentfulCollection<T> of ApiKey.

Implements
IContentfulManagementClient.GetAllApiKeys(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetAllExtensions(String, CancellationToken)

Gets a collection of all UiExtension for a space.

Declaration
public Task<ContentfulCollection<UiExtension>> GetAllExtensions(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<UiExtension>>

A ContentfulCollection<T> of UiExtension.

Implements
IContentfulManagementClient.GetAllExtensions(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetAllManagementTokens(CancellationToken)

Gets a collection of all ManagementToken for a user. Note that the actual token will not be part of the response. It is only available directly after creation of a token for security reasons.

Declaration
public Task<ContentfulCollection<ManagementToken>> GetAllManagementTokens(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<ManagementToken>>

A ContentfulCollection<T> of Organization.

Implements
IContentfulManagementClient.GetAllManagementTokens(CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetAllPreviewApiKeys(String, CancellationToken)

Gets a collection of all preview ApiKey in a space.

Declaration
public Task<ContentfulCollection<ApiKey>> GetAllPreviewApiKeys(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<ApiKey>>

A ContentfulCollection<T> of ApiKey.

Implements
IContentfulManagementClient.GetAllPreviewApiKeys(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetAllRoles(String, CancellationToken)

Gets all Role of a space.

Declaration
public Task<ContentfulCollection<Role>> GetAllRoles(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<Role>>

A ContentfulCollection<T> of Role.

Implements
IContentfulManagementClient.GetAllRoles(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetAllSnapshotsForContentType(String, String, CancellationToken)

Gets all snapshots for a ContentType.

Declaration
public Task<ContentfulCollection<SnapshotContentType>> GetAllSnapshotsForContentType(string contentTypeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String contentTypeId

The id of the content type to get snapshots for.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<SnapshotContentType>>

A collection of SnapshotContentType.

Implements
IContentfulManagementClient.GetAllSnapshotsForContentType(String, String, CancellationToken)

GetAllSnapshotsForEntry(String, String, CancellationToken)

Gets all snapshots for an Entry<T>.

Declaration
public Task<ContentfulCollection<Snapshot>> GetAllSnapshotsForEntry(string entryId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String entryId

The id of the entry to get snapshots for.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<Snapshot>>

A collection of Snapshot.

Implements
IContentfulManagementClient.GetAllSnapshotsForEntry(String, String, CancellationToken)

GetAllUsers(String, CancellationToken)

Gets a collection of all User in a space.

Declaration
public Task<ContentfulCollection<User>> GetAllUsers(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<User>>

A ContentfulCollection<T> of ApiKey.

Implements
IContentfulManagementClient.GetAllUsers(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetApiKey(String, String, CancellationToken)

Gets an ApiKey in a space.

Declaration
public Task<ApiKey> GetApiKey(string apiKeyId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String apiKeyId

The id of the api key get.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ApiKey>

A ContentfulCollection<T> of ApiKey.

Implements
IContentfulManagementClient.GetApiKey(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetAsset(String, String, CancellationToken)

Gets an asset by the specified id.

Declaration
public Task<ManagementAsset> GetAsset(string assetId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String assetId

The id of the asset to get.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The ManagementAsset.

Implements
IContentfulManagementClient.GetAsset(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The assetId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetAssetsCollection(QueryBuilder<Asset>, String, CancellationToken)

Gets all assets of a space, filtered by an optional QueryBuilder<T>.

Declaration
public Task<ContentfulCollection<ManagementAsset>> GetAssetsCollection(QueryBuilder<Asset> queryBuilder, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
QueryBuilder<Asset> queryBuilder

The optional QueryBuilder<T> to add additional filtering to the query.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<ManagementAsset>>

A ContentfulCollection<T> of ManagementAsset.

Implements
IContentfulManagementClient.GetAssetsCollection(QueryBuilder<Asset>, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetAssetsCollection(String, String, CancellationToken)

Gets all assets in the space.

Declaration
public Task<ContentfulCollection<ManagementAsset>> GetAssetsCollection(string queryString = null, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String queryString

The optional querystring to add additional filtering to the query.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<ManagementAsset>>

A ContentfulCollection<T> of ManagementAsset.

Implements
IContentfulManagementClient.GetAssetsCollection(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetContentType(String, String, CancellationToken)

Gets a ContentType by the specified id.

Declaration
public Task<ContentType> GetContentType(string contentTypeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String contentTypeId

The id of the content type.

System.String spaceId

The id of the space to get the content type from. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentType>

The response from the API serialized into a ContentType.

Implements
IContentfulManagementClient.GetContentType(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The contentTypeId parameter was null or empty

GetContentTypes(String, CancellationToken)

Get all content types of a space.

Declaration
public Task<IEnumerable<ContentType>> GetContentTypes(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space to get the content types of. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ContentType>>

An System.Collections.Generic.IEnumerable<T> of ContentType.

Implements
IContentfulManagementClient.GetContentTypes(String, CancellationToken)

GetCurrentUser(CancellationToken)

Gets a single User for the currently logged in user.

Declaration
public Task<User> GetCurrentUser(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<User>

The User.

Implements
IContentfulManagementClient.GetCurrentUser(CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetEditorInterface(String, String, CancellationToken)

Gets a EditorInterface for a specific ContentType.

Declaration
public Task<EditorInterface> GetEditorInterface(string contentTypeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String contentTypeId

The id of the content type.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<EditorInterface>

The response from the API serialized into a EditorInterface.

Implements
IContentfulManagementClient.GetEditorInterface(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The contentTypeId parameter was null or empty

GetEntriesCollection<T>(QueryBuilder<T>, CancellationToken)

Gets all the entries of a space, filtered by an optional QueryBuilder<T>.

Declaration
public Task<ContentfulCollection<T>> GetEntriesCollection<T>(QueryBuilder<T> queryBuilder, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
QueryBuilder<T> queryBuilder

The optional QueryBuilder<T> to add additional filtering to the query.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<T>>

A ContentfulCollection<T> of items.

Type Parameters
Name Description
T

The type to serialize the response into.

Implements
IContentfulManagementClient.GetEntriesCollection<T>(QueryBuilder<T>, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetEntriesCollection<T>(String, CancellationToken)

Gets all the entries of a space, filtered by an optional querystring. A simpler approach than to construct a query manually is to use the QueryBuilder<T> class.

Declaration
public Task<ContentfulCollection<T>> GetEntriesCollection<T>(string queryString = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String queryString

The optional querystring to add additional filtering to the query.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<T>>

A ContentfulCollection<T> of items.

Type Parameters
Name Description
T

The type to serialize the response into.

Implements
IContentfulManagementClient.GetEntriesCollection<T>(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetEntriesForLocale<T>(QueryBuilder<T>, String, String, CancellationToken)

Gets all the entries of a space in a specific locale, filtered by an optional QueryBuilder<T>.

Declaration
public Task<ContentfulCollection<T>> GetEntriesForLocale<T>(QueryBuilder<T> queryBuilder, string locale = null, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
QueryBuilder<T> queryBuilder

The optional QueryBuilder<T> to add additional filtering to the query.

System.String locale

The locale to fetch entries for. Defaults to the default of the space.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<T>>

A ContentfulCollection<T> of items.

Type Parameters
Name Description
T
Implements
IContentfulManagementClient.GetEntriesForLocale<T>(QueryBuilder<T>, String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetEntry(String, String, CancellationToken)

Get a single entry by the specified id.

Declaration
public Task<Entry<dynamic>> GetEntry(string entryId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String entryId

The id of the entry.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The response from the API serialized into Entry<T>

Implements
IContentfulManagementClient.GetEntry(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The entryId parameter was null or empty.

GetEnvironment(String, String, CancellationToken)

Gets a ContentfulEnvironment for a space.

Declaration
public Task<ContentfulEnvironment> GetEnvironment(string id, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String id

The id of the environment to get.

System.String spaceId

The id of the space to get an environment in. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulEnvironment>

The ContentfulEnvironment.

Implements
IContentfulManagementClient.GetEnvironment(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The required arguments were not provided.

ContentfulException

There was an error when communicating with the Contentful API.

GetEnvironments(String, CancellationToken)

Gets a collection of all ContentfulEnvironment for a space.

Declaration
public Task<ContentfulCollection<ContentfulEnvironment>> GetEnvironments(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space to get environments for. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<ContentfulEnvironment>>

A ContentfulCollection<T> of ContentfulEnvironment.

Implements
IContentfulManagementClient.GetEnvironments(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetExtension(String, String, CancellationToken)

Gets a single UiExtension for a space.

Declaration
public Task<UiExtension> GetExtension(string extensionId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String extensionId

The id of the extension to get.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<UiExtension>

The UiExtension.

Implements
IContentfulManagementClient.GetExtension(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The extensionId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetLocale(String, String, CancellationToken)

Gets a locale in the specified Space.

Declaration
public Task<Locale> GetLocale(string localeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String localeId

The id of the locale to get.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Locale>

The requested Locale.

Implements
IContentfulManagementClient.GetLocale(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The localeId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetLocalesCollection(String, CancellationToken)

Gets all locales in a Space.

Declaration
public Task<ContentfulCollection<Locale>> GetLocalesCollection(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<Locale>>

A ContentfulCollection<T> of locales.

Implements
IContentfulManagementClient.GetLocalesCollection(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetManagementToken(String, CancellationToken)

Gets a single ManagementToken for a user.

Declaration
public Task<ManagementToken> GetManagementToken(string managementTokenId, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String managementTokenId

The id of the management token to get.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementToken>

The ManagementToken.

Implements
IContentfulManagementClient.GetManagementToken(String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The managementTokenId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetOrganizationMembership(String, String, CancellationToken)

Gets a single OrganizationMembership for a space.

Declaration
public Task<OrganizationMembership> GetOrganizationMembership(string membershipId, string organizationId, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String membershipId

The id of the membership to get.

System.String organizationId

The id of the organization.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<OrganizationMembership>

The SpaceMembership.

Implements
IContentfulManagementClient.GetOrganizationMembership(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The spaceMembershipId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetOrganizationMemberships(String, String, CancellationToken)

Gets a collection of OrganizationMembership for the specified organization.

Declaration
public Task<ContentfulCollection<OrganizationMembership>> GetOrganizationMemberships(string organizationId, string queryString = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String organizationId

The id of the organization.

System.String queryString

The optional querystring to add additional filtering to the query.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<OrganizationMembership>>

A collection of OrganizationMembership.

Implements
IContentfulManagementClient.GetOrganizationMemberships(String, String, CancellationToken)

GetOrganizations(CancellationToken)

Gets a collection of all Organization for a user.

Declaration
public Task<ContentfulCollection<Organization>> GetOrganizations(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<Organization>>

A ContentfulCollection<T> of Organization.

Implements
IContentfulManagementClient.GetOrganizations(CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetPreviewApiKey(String, String, CancellationToken)

Gets a preview ApiKey in a space.

Declaration
public Task<ApiKey> GetPreviewApiKey(string apiKeyId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String apiKeyId

The id of the api key get.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ApiKey>

A ContentfulCollection<T> of ApiKey.

Implements
IContentfulManagementClient.GetPreviewApiKey(String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetPublishedAssetsCollection(String, CancellationToken)

Gets all published assets in the space.

Declaration
public Task<ContentfulCollection<ManagementAsset>> GetPublishedAssetsCollection(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<ManagementAsset>>

A ContentfulCollection<T> of ManagementAsset.

Implements
IContentfulManagementClient.GetPublishedAssetsCollection(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetResourceUsage(String, String, String, CancellationToken)

Gets a collection of ApiUsage for an organization.

Declaration
public Task<ContentfulCollection<ApiUsage>> GetResourceUsage(string organizationId, string type, string queryString = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String organizationId

The id of the organization to get usage for.

System.String type

The type of resource to get usage for, organization or space.

System.String queryString

The optional querystring to add additional filtering to the query.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<ApiUsage>>

A ContentfulCollection<T> of ApiUsage.

Implements
IContentfulManagementClient.GetResourceUsage(String, String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetRole(String, String, CancellationToken)

Gets a role by the specified id.

Declaration
public Task<Role> GetRole(string roleId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String roleId

The id of the role.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Role>

The Role

Implements
IContentfulManagementClient.GetRole(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The roleId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetSnapshotForContentType(String, String, String, CancellationToken)

Gets a single snapshot for a ContentType

Declaration
public Task<SnapshotContentType> GetSnapshotForContentType(string snapshotId, string contentTypeId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String snapshotId

The id of the snapshot to get.

System.String contentTypeId

The id of content type the snapshot belongs to.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<SnapshotContentType>

The SnapshotContentType.

Implements
IContentfulManagementClient.GetSnapshotForContentType(String, String, String, CancellationToken)

GetSnapshotForEntry(String, String, String, CancellationToken)

Gets a single snapshot for an Entry<T>

Declaration
public Task<Snapshot> GetSnapshotForEntry(string snapshotId, string entryId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String snapshotId

The id of the snapshot to get.

System.String entryId

The id of entry the snapshot belongs to.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Snapshot>

The Snapshot.

Implements
IContentfulManagementClient.GetSnapshotForEntry(String, String, String, CancellationToken)

GetSpace(String, CancellationToken)

Gets a space in Contentful.

Declaration
public Task<Space> GetSpace(string id, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String id

The id of the space to get.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Space>

The Space

Implements
IContentfulManagementClient.GetSpace(String, CancellationToken)

GetSpaceMembership(String, String, CancellationToken)

Gets a single SpaceMembership for a space.

Declaration
public Task<SpaceMembership> GetSpaceMembership(string spaceMembershipId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceMembershipId

The id of the space membership to get.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<SpaceMembership>

The SpaceMembership.

Implements
IContentfulManagementClient.GetSpaceMembership(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The spaceMembershipId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetSpaceMemberships(String, CancellationToken)

Gets a collection of SpaceMembership for the user.

Declaration
public Task<ContentfulCollection<SpaceMembership>> GetSpaceMemberships(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<SpaceMembership>>

A collection of SpaceMembership.

Implements
IContentfulManagementClient.GetSpaceMemberships(String, CancellationToken)

GetSpaces(CancellationToken)

Gets all spaces in Contentful.

Declaration
public Task<IEnumerable<Space>> GetSpaces(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Space>>

An System.Collections.Generic.IEnumerable<T> of Space.

Implements
IContentfulManagementClient.GetSpaces(CancellationToken)

GetUpload(String, String, CancellationToken)

Gets an upload SystemProperties by the specified id.

Declaration
public Task<UploadReference> GetUpload(string uploadId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String uploadId

The id of the uploaded file.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<UploadReference>

A SystemProperties with metadata of the upload.

Implements
IContentfulManagementClient.GetUpload(String, String, CancellationToken)

GetUsagePeriods(String, CancellationToken)

Gets a collection of all UsagePeriod for an organization.

Declaration
public Task<ContentfulCollection<UsagePeriod>> GetUsagePeriods(string organizationId, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String organizationId

The id of the organization to get usage periods for.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<UsagePeriod>>

A ContentfulCollection<T> of UsagePeriod.

Implements
IContentfulManagementClient.GetUsagePeriods(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

GetUser(String, String, CancellationToken)

Gets a single User for a space.

Declaration
public Task<User> GetUser(string userId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String userId

The id of the user to get.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<User>

The User.

Implements
IContentfulManagementClient.GetUser(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The spaceMembershipId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetWebhook(String, String, CancellationToken)

Gets a single webhook from a Space.

Declaration
public Task<Webhook> GetWebhook(string webhookId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String webhookId

The id of the webhook to get.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Webhook>

The Webhook.

Implements
IContentfulManagementClient.GetWebhook(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The webhookId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetWebhookCallDetails(String, String, String, CancellationToken)

Gets the details of a specific webhook call.

Declaration
public Task<WebhookCallDetails> GetWebhookCallDetails(string callId, string webhookId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String callId

The id of the call to get details for.

System.String webhookId

The id of the webhook to get details for.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<WebhookCallDetails>

The WebhookCallDetails.

Implements
IContentfulManagementClient.GetWebhookCallDetails(String, String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The webhookId or callId parameter was null or empty.

GetWebhookCallDetailsCollection(String, String, CancellationToken)

Gets all recent call details for a webhook.

Declaration
public Task<ContentfulCollection<WebhookCallDetails>> GetWebhookCallDetailsCollection(string webhookId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String webhookId

The id of the webhook to get details for.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<WebhookCallDetails>>

A ContentfulCollection<T> of WebhookCallDetails.

Implements
IContentfulManagementClient.GetWebhookCallDetailsCollection(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The webhookId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetWebhookHealth(String, String, CancellationToken)

Gets a response containing an overview of the recent webhook calls.

Declaration
public Task<WebhookHealthResponse> GetWebhookHealth(string webhookId, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String webhookId

The id of the webhook to get health details for.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<WebhookHealthResponse>

A WebhookHealthResponse.

Implements
IContentfulManagementClient.GetWebhookHealth(String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The webhookId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

GetWebhooksCollection(String, CancellationToken)

Gets all webhooks for a Space.

Declaration
public Task<ContentfulCollection<Webhook>> GetWebhooksCollection(string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ContentfulCollection<Webhook>>

A ContentfulCollection<T> of Webhook.

Implements
IContentfulManagementClient.GetWebhooksCollection(String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

ProcessAsset(String, Int32, String, String, CancellationToken)

Processes an asset by the specified id.

Declaration
public Task ProcessAsset(string assetId, int version, string locale, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String assetId

The id of the asset to process.

System.Int32 version

The last known version of the asset.

System.String locale

The locale for which files should be processed.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task
Implements
IContentfulManagementClient.ProcessAsset(String, Int32, String, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The assetId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

ProcessAssetUntilCompleted(String, Int32, String, Int32, String, CancellationToken)

Processes an asset by the specified id and keeps polling the API until it has finished processing. Note that this might result in multiple API calls.

Declaration
public Task<ManagementAsset> ProcessAssetUntilCompleted(string assetId, int version, string locale, int maxDelay = 2000, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String assetId

The id of the asset to process.

System.Int32 version

The last known version of the asset.

System.String locale

The locale for which files should be processed.

System.Int32 maxDelay

The maximum number of milliseconds allowed for the operation.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The ManagementAsset that has been processed.

Implements
IContentfulManagementClient.ProcessAssetUntilCompleted(String, Int32, String, Int32, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The assetId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

System.TimeoutException

The processing of the asset did not finish within the allotted time.

PublishAsset(String, Int32, String, CancellationToken)

Publishes an asset by the specified id.

Declaration
public Task<ManagementAsset> PublishAsset(string assetId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String assetId

The id of the asset to publish.

System.Int32 version

The last known version of the asset.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The ManagementAsset published.

Implements
IContentfulManagementClient.PublishAsset(String, Int32, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The assetId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

PublishEntry(String, Int32, String, CancellationToken)

Publishes an entry by the specified id.

Declaration
public Task<Entry<dynamic>> PublishEntry(string entryId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String entryId

The id of the entry.

System.Int32 version

The last known version of the entry.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The response from the API serialized into Entry<T>

Implements
IContentfulManagementClient.PublishEntry(String, Int32, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The entryId parameter was null or empty.

RevokeManagementToken(String, CancellationToken)

Revokes a single ManagementToken for a user.

Declaration
public Task<ManagementToken> RevokeManagementToken(string managementTokenId, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String managementTokenId

The id of the management token to revoke.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementToken>

The revoked ManagementToken.

Implements
IContentfulManagementClient.RevokeManagementToken(String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The managementTokenId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

UnarchiveAsset(String, Int32, String, CancellationToken)

Unarchives an asset by the specified id.

Declaration
public Task<ManagementAsset> UnarchiveAsset(string assetId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String assetId

The id of the asset to unarchive.

System.Int32 version

The last known version of the asset.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The ManagementAsset unarchived.

Implements
IContentfulManagementClient.UnarchiveAsset(String, Int32, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The assetId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

UnarchiveEntry(String, Int32, String, CancellationToken)

Unarchives an entry by the specified id.

Declaration
public Task<Entry<dynamic>> UnarchiveEntry(string entryId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String entryId

The id of the entry.

System.Int32 version

The last known version of the entry.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The response from the API serialized into Entry<T>

Implements
IContentfulManagementClient.UnarchiveEntry(String, Int32, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The entryId parameter was null or empty.

UnpublishAsset(String, Int32, String, CancellationToken)

Unpublishes an asset by the specified id.

Declaration
public Task<ManagementAsset> UnpublishAsset(string assetId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String assetId

The id of the asset to unpublish.

System.Int32 version

The last known version of the asset.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The ManagementAsset unpublished.

Implements
IContentfulManagementClient.UnpublishAsset(String, Int32, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The assetId parameter was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

UnpublishEntry(String, Int32, String, CancellationToken)

Unpublishes an entry by the specified id.

Declaration
public Task<Entry<dynamic>> UnpublishEntry(string entryId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String entryId

The id of the entry.

System.Int32 version

The last known version of the entry.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The response from the API serialized into Entry<T>

Implements
IContentfulManagementClient.UnpublishEntry(String, Int32, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The entryId parameter was null or empty.

UpdateApiKey(String, String, String, Int32, String, CancellationToken)

Updates an ApiKey in a space.

Declaration
public Task<ApiKey> UpdateApiKey(string id, string name, string description, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String id

The id of the API key to update.

System.String name

The name of the API key to update.

System.String description

The description of the API key to update.

System.Int32 version

The last known version of the api key.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ApiKey>

The updated ApiKey.

Implements
IContentfulManagementClient.UpdateApiKey(String, String, String, Int32, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

UpdateEditorInterface(EditorInterface, String, Int32, String, CancellationToken)

Updates a EditorInterface for a specific ContentType.

Declaration
public Task<EditorInterface> UpdateEditorInterface(EditorInterface editorInterface, string contentTypeId, int version, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
EditorInterface editorInterface

The editor interface to update.

System.String contentTypeId

The id of the content type.

System.Int32 version

The last known version of the content type.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<EditorInterface>

The response from the API serialized into a EditorInterface.

Implements
IContentfulManagementClient.UpdateEditorInterface(EditorInterface, String, Int32, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

System.ArgumentException

The contentTypeId parameter was null or empty

UpdateEntryForLocale(Object, String, String, String, CancellationToken)

Updates an entry fields for a certain locale using the values from the provided object.

Declaration
public Task<Entry<dynamic>> UpdateEntryForLocale(object entry, string id, string locale = null, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Object entry

The object to use as values for the entry fields.

System.String id

The id of the entry to update.

System.String locale

The locale to set the fields for. The default locale for the space will be used if this parameter is null or empty.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Entry<System.Object>>

The updated Entry<T>.

Implements
IContentfulManagementClient.UpdateEntryForLocale(Object, String, String, String, CancellationToken)

UpdateLocale(Locale, String, CancellationToken)

Updates a locale in the specified Space.

Declaration
public Task<Locale> UpdateLocale(Locale locale, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Locale locale

The Locale to update.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Locale>

The created Locale.

Implements
IContentfulManagementClient.UpdateLocale(Locale, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

UpdateOrganizationMembership(String, String, String, CancellationToken)

Updates a OrganizationMembership for a space.

Declaration
public Task<OrganizationMembership> UpdateOrganizationMembership(string role, string membershipId, string organizationId, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String role

The role to set for the membership.

System.String membershipId

The id of the membership to update.

System.String organizationId

The id of the organization.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<OrganizationMembership>

The OrganizationMembership.

Implements
IContentfulManagementClient.UpdateOrganizationMembership(String, String, String, CancellationToken)
Exceptions
Type Condition
ContentfulException

There was an error when communicating with the Contentful API.

UpdateRole(Role, String, CancellationToken)

Updates a role in a Space.

Declaration
public Task<Role> UpdateRole(Role role, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Role role

The role to update.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Role>

The updated Role.

Implements
IContentfulManagementClient.UpdateRole(Role, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The id parameter of the role was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

UpdateSpaceMembership(SpaceMembership, String, CancellationToken)

Updates a SpaceMembership for a space.

Declaration
public Task<SpaceMembership> UpdateSpaceMembership(SpaceMembership spaceMembership, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
SpaceMembership spaceMembership

The membership to update.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<SpaceMembership>

The SpaceMembership.

Implements
IContentfulManagementClient.UpdateSpaceMembership(SpaceMembership, String, CancellationToken)
Exceptions
Type Condition
System.ArgumentException

The spaceMembership id was null or empty.

ContentfulException

There was an error when communicating with the Contentful API.

UpdateSpaceName(Space, String, CancellationToken)

Updates the name of a space in Contentful.

Declaration
public Task<Space> UpdateSpaceName(Space space, string organisation = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
Space space

The space to update, needs to contain at minimum name, Id and version.

System.String organisation

The organisation to update a space for. Not required if the account belongs to only one organisation.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Space>

The updated Space

Implements
IContentfulManagementClient.UpdateSpaceName(Space, String, CancellationToken)

UpdateSpaceName(String, String, Int32, String, CancellationToken)

Updates a space in Contentful.

Declaration
public Task<Space> UpdateSpaceName(string id, string name, int version, string organisation = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.String id

The id of the space to update.

System.String name

The name to update to.

System.Int32 version

The version of the space that will be updated.

System.String organisation

The organisation to update a space for. Not required if the account belongs to only one organisation.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<Space>

The updated Space

Implements
IContentfulManagementClient.UpdateSpaceName(String, String, Int32, String, CancellationToken)

UploadFile(Byte[], String, CancellationToken)

Uploads the specified bytes to Contentful.

Declaration
public Task<UploadReference> UploadFile(byte[] bytes, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
System.Byte[] bytes

The bytes to upload.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<UploadReference>

A SystemProperties with an id of the created upload.

Implements
IContentfulManagementClient.UploadFile(Byte[], String, CancellationToken)

UploadFileAndCreateAsset(ManagementAsset, Byte[], String, CancellationToken)

Uploads an array of bytes and creates an asset in Contentful as well as processing that asset.

Declaration
public Task<ManagementAsset> UploadFileAndCreateAsset(ManagementAsset asset, byte[] bytes, string spaceId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type Name Description
ManagementAsset asset

The asset to create

System.Byte[] bytes

The bytes to upload.

System.String spaceId

The id of the space. Will default to the one set when creating the client.

System.Threading.CancellationToken cancellationToken

The optional cancellation token to cancel the operation.

Returns
Type Description
System.Threading.Tasks.Task<ManagementAsset>

The created ManagementAsset.

Implements
IContentfulManagementClient.UploadFileAndCreateAsset(ManagementAsset, Byte[], String, CancellationToken)
Back to top Copyright © 2015-2016 Contentful
Generated by DocFX