All Projects → contentful → contentful.net

contentful / contentful.net

Licence: MIT license
.NET Library for Contentful's Content Delivery and Management API

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to contentful.net

Strapi
🚀 Open source Node.js Headless CMS to easily build customisable APIs
Stars: ✭ 41,786 (+55614.67%)
Mutual labels:  content-management, headless-cms
Dc Delivery Sdk Js
Official Javascript SDK for the Amplience Dynamic Content Delivery API
Stars: ✭ 51 (-32%)
Mutual labels:  content-management, headless-cms
Kirby
Kirby's core application folder
Stars: ✭ 436 (+481.33%)
Mutual labels:  content-management, headless-cms
laravel-storyblok
Make Laravel and Storyblok work together beautifully.
Stars: ✭ 45 (-40%)
Mutual labels:  content-management, headless-cms
vaahcms
VaahCMS is a laravel based open-source web application development platform shipped with a headless content management system (CMS).
Stars: ✭ 56 (-25.33%)
Mutual labels:  content-management, headless-cms
kontent-sample-app-react
Sample React SPA utilizing the Kontent Delivery API to fetch content.
Stars: ✭ 45 (-40%)
Mutual labels:  content-delivery, headless-cms
Dc Management Sdk Js
Amplience Dynamic Content Management SDK
Stars: ✭ 47 (-37.33%)
Mutual labels:  content-management, headless-cms
Flextype
Hybrid Content Management System with the freedom of a headless CMS and with the full functionality of a traditional CMS
Stars: ✭ 436 (+481.33%)
Mutual labels:  content-management, headless-cms
Unite Cms
Really flexible headless CMS, built on top of Symfony and GraphQL.
Stars: ✭ 242 (+222.67%)
Mutual labels:  content-management, headless-cms
Spring Content
Cloud-Native Storage and Enterprise Content Services (ECMS) for Spring
Stars: ✭ 151 (+101.33%)
Mutual labels:  content-management, headless-cms
Daptin
Daptin - Backend As A Service - GraphQL/JSON-API Headless CMS
Stars: ✭ 1,195 (+1493.33%)
Mutual labels:  content-management, headless-cms
gatsby-starter
Gatsby Starter for creating portfolio & blog.
Stars: ✭ 55 (-26.67%)
Mutual labels:  contentful, headless-cms
contentful-hugo
A CLI tool that pulls data from Contentful and turns it into markdown files for Hugo and other static site generators. It also includes an express server that can be used for local development and content previews
Stars: ✭ 31 (-58.67%)
Mutual labels:  contentful, headless-cms
pageflo
A new super flexible open source CMS
Stars: ✭ 34 (-54.67%)
Mutual labels:  content-management, headless-cms
solidus static content
📄 Content management for your Solidus store.
Stars: ✭ 18 (-76%)
Mutual labels:  content-management
buzzyblog
React + WordPress REST API, a new endeavor to provide a better experience to content creators, web masters and digital marketers, etc
Stars: ✭ 50 (-33.33%)
Mutual labels:  headless-cms
pocket-cms
☁️ A pocket sized CMS written for nodejs
Stars: ✭ 13 (-82.67%)
Mutual labels:  headless-cms
the-example-app.swift
Example app for Contentful in Swift
Stars: ✭ 35 (-53.33%)
Mutual labels:  contentful
deruv
The elegant and professional PHP Content Management System
Stars: ✭ 38 (-49.33%)
Mutual labels:  content-management
contentful-export
Extract Contentful to Hugo
Stars: ✭ 22 (-70.67%)
Mutual labels:  contentful

header

Join Contentful Community Slack   Join Contentful Community Forum

contentful.net - Contentful .NET Library

.NET library for the Contentful Content Delivery API, Content Preview API and the Contentful Management API. It helps you to easily access your Content stored in Contentful with your .NET applications.

This repository is actively maintained   MIT License   Build Status

What is Contentful?

Contentful provides content infrastructure for digital teams to power websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship their products faster.

Table of contents

Core Features

Getting started

We recommend you use the NuGet Package Manager to add the library to your .NET Application using one of the following options:

  • In Visual Studio, open Package Manager Console window and run the following command:

    PM> Install-Package contentful.csharp
  • In a command-line, run the following .NET CLI command:

    > dotnet add package contentful.csharp

Usage

The ContentfulClient handles all communication with the Contentful Content Delivery API.

To create a new client you need to pass an HttpClient, your delivery API key and any other configuration options:

var httpClient = new HttpClient();
var client = new ContentfulClient(httpClient, "<content_delivery_api_key>", "<content_preview_api_key>", "<space_id>");

or:

var httpClient = new HttpClient();
var options = new ContentfulOptions
{
    DeliveryApiKey = "<content_delivery_api_key>",
    PreviewApiKey = "<content_preview_api_key>",
    SpaceId = "<space_id>"
};
var client = new ContentfulClient(httpClient, options);

If you are running asp.net core and wish to take advantage of the options pattern you can do so by passing an IOptions<ContentfulOptions> to the constructor. This lets you keep your authorization token in your application settings, in environment variables or your own custom Microsoft.Extensions.Configuration.IConfigurationSource provider.

Your first request

After creating a ContentfulClient, you can now query for a single entry:

var entry = await client.GetEntry<Product>("<entry_id>");

Console.WriteLine(entry.ProductName); // => Contentful
Console.WriteLine(entry.Price); // => 12.38
Console.WriteLine(entry.Description); // => A fantastic product.
public class Product
{
    public string ProductName { get; set; }
    public string Price { get; set; }
    public string Description { get; set; }
}

The properties of your class will be automatically deserialized from fields with matching names.

If you're interested in the system properties of the entry, add a SystemProperties property to the class.

public class Product
{
    public SystemProperties Sys { get; set; }
    public string ProductName { get; set; }
    public string Price { get; set; }
    public string Description { get; set; }
}
var productEntry = await client.GetEntry<Product>("<entry_id>");

Console.WriteLine(productEntry.Price); // => 12.38
Console.WriteLine(productEntry.Sys.Id); // => 2CfTFQGwogugS6QcOuwO6q

Management API

To edit, update and delete content you use the ContentfulManagementClient class which uses the same familiar pattern as the regular client.

var httpClient = new HttpClient();
var managementClient = new ContentfulManagementClient(httpClient, "<content_management_api_key>", "<space_id>");

You can then use the client to, for example, create a content type.

var contentType = new ContentType();
contentType.SystemProperties = new SystemProperties()
{
    Id = "new-content-type"
};
contentType.Name = "New contenttype";
contentType.Fields = new List<Field>()
{
    new Field()
    {
        Name = "Field1",
        Id = "field1",
        Type = "Text"
    },
    new Field()
    {
        Name = "Field2",
        Id = "field2",
        Type = "Integer"
    }
};


await managementClient.CreateOrUpdateContentType(contentType);

Using the library with the Preview API

This library can also be used with the Preview API. Make sure you have a preview API key configured and set UsePreviewAPI on your client.

var httpClient = new HttpClient();
var options = new ContentfulOptions()
{
    DeliveryApiKey = "<content_delivery_api_key>",
    PreviewApiKey, "<content_preview_api_key>"
    SpaceId = "<space_id>",
    UsePreviewApi = true
}
var client = new ContentfulClient(httpClient, options);

Authentication

To get your own content from Contentful, an app should authenticate with an OAuth bearer token.

You can create API keys using the Contentful web interface. Go to the app, open the space that you want to access (top left corner lists all the spaces), and navigate to the APIs area. Open the API Keys section and create your first token. Done.

For more information, check the Contentful REST API reference on Authentication.

Further documentation

You can read the full documentation at https://www.contentful.com/developers/docs/net/ and explore the api at https://contentful.github.io/contentful.net-docs/

Reach out to us

You have questions about how to use this library?

  • Reach out to our community forum: Contentful Community Forum
  • Jump into our community slack channel: Contentful Community Slack

You found a bug or want to propose a feature?

  • File an issue here on GitHub: File an issue. Make sure to remove any credentials from your code before sharing it.

You need to share confidential information or have other questions?

  • File a support ticket at our Contentful Customer Support: File support ticket

Get involved

PRs Welcome

We appreciate any help on our repositories. For more details about how to contribute see our CONTRIBUTING.md document.

License

This repository is published under the MIT license.

Code of Conduct

We want to provide a safe, inclusive, welcoming, and harassment-free space and experience for all participants, regardless of gender identity and expression, sexual orientation, disability, physical appearance, socioeconomic status, body size, ethnicity, nationality, level of experience, age, religion (or lack thereof), or other identity markers.

Read our full Code of Conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].