Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

contentful

Package Overview
Dependencies
Maintainers
3
Versions
450
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contentful

Client for Contentful's Content Delivery API

  • 11.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
539K
decreased by-17.31%
Maintainers
3
Weekly downloads
 
Created

What is contentful?

The contentful npm package is a JavaScript client for the Contentful Content Delivery API and Content Management API. It allows developers to fetch and manage content from Contentful's content infrastructure, making it easy to integrate content into web and mobile applications.

What are contentful's main functionalities?

Fetching Entries

This feature allows you to fetch entries from your Contentful space. The code sample demonstrates how to create a client and fetch all entries.

const contentful = require('contentful');
const client = contentful.createClient({
  space: 'your_space_id',
  accessToken: 'your_access_token'
});

client.getEntries()
  .then((response) => console.log(response.items))
  .catch(console.error);

Fetching a Single Entry

This feature allows you to fetch a single entry by its ID. The code sample shows how to create a client and fetch a specific entry.

const contentful = require('contentful');
const client = contentful.createClient({
  space: 'your_space_id',
  accessToken: 'your_access_token'
});

client.getEntry('entry_id')
  .then((entry) => console.log(entry))
  .catch(console.error);

Fetching Assets

This feature allows you to fetch assets from your Contentful space. The code sample demonstrates how to create a client and fetch all assets.

const contentful = require('contentful');
const client = contentful.createClient({
  space: 'your_space_id',
  accessToken: 'your_access_token'
});

client.getAssets()
  .then((response) => console.log(response.items))
  .catch(console.error);

Content Management

This feature allows you to manage content, such as creating new entries. The code sample shows how to create a client and create a new entry in a specific content type.

const contentfulManagement = require('contentful-management');
const client = contentfulManagement.createClient({
  accessToken: 'your_management_access_token'
});

client.getSpace('your_space_id')
  .then((space) => space.createEntry('content_type_id', {
    fields: {
      title: {
        'en-US': 'Hello, World!'
      }
    }
  }))
  .then((entry) => console.log(entry))
  .catch(console.error);

Other packages similar to contentful

FAQs

Package last updated on 25 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc