Skip to content

Instantly share code, notes, and snippets.

@jonearley jonearley/drupal-api.md
Last active Dec 19, 2018

Embed
What would you like to do?

[DRAFT] Drupal API

Documentation for the API between Drupal and Gatsby.

Content types

Definition

{
  type: STRING,
    // The unique Drupal node type
    
  id: STRING
    // The unique Drupal entity id.
    
  fields: {
    // An OBJECT with fields keyed by uid.
  
    [uid]: {
      // A unique machine readable identifier for the field.
      
      name: STRING
        // A human readable name for the field.
      
      value: ANYTHING
        // Usually this will be a string which is safe to show to users, such as
        // a title, but it could be anything.
        
      fetch: URL
        // An optional URL to fetch the value.
    }
  }
}

Example

{
  type: "page",
  id: "bb67f158-d870-4022-83d6-875760f9ce38",
  fields: {
    title: {
      name: "Title",
      value: "Study Spaces"
    },
    body: {
      name: "Body",
      value: "## Book a room\r\n\r\nAnd some text."
    },
    slug: {
      name: "Slug",
      value: "/study-spaces"
    },
    image: {
      name: "Image",
      value: {
        url: ""
      }
    },
    breadcrumbs: {
      name: "Breadcrumbs"
      value: [
        { text: "Home", to: "/" },
        { text: "Study Spaces", to: "/study-spaces" }
      ]
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.