Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ApiKey

Hierarchy

Index

Properties

accessToken

accessToken: string

Optional description

description: undefined | string

environments

environments: { sys: MetaLinkProps }[]

name

name: string

Optional policies

policies: { action: string; effect: string }[]

preview_api_key

preview_api_key: { sys: MetaLinkProps }

Type declaration

sys

Methods

delete

  • delete(): Promise<void>
  • Deletes this object on the server.

    example
    const contentful = require('contentful-management')
    
    const client = contentful.createClient({
      accessToken: '<content_management_api_key>'
    })
    client.getSpace('<space_id>')
    .then((space) => space.getApiKey(<api-key-id>))
    .then((apiKey) => apiKey.delete())
    .then(() => console.log('apikey deleted'))
    .catch(console.error)
    

    Returns Promise<void>

    Promise for the deletion. It contains no data, but the Promise error case should be handled.

toPlainObject

update

  • Sends an update to the server with any changes made to the object's properties

    example
    const contentful = require('contentful-management')
    
    const client = contentful.createClient({
      accessToken: '<content_management_api_key>'
    })
    client.getSpace('<space_id>')
    .then((space) => space.getApiKey(<api-key-id>))
    .then((apiKey) => {
     apiKey.name = 'New name'
     return apiKey.update()
    })
    .then(apiKey => console.log(apiKey.name))
    .catch(console.error)
    

    Returns Promise<ApiKey>

    Object returned from the server with updated changes.