Skip to content

Instantly share code, notes, and snippets.

@bdunogier
Last active July 7, 2019 19:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdunogier/f2f892b2fbd37b7fd7a8597fd8b4b200 to your computer and use it in GitHub Desktop.
Save bdunogier/f2f892b2fbd37b7fd7a8597fd8b4b200 to your computer and use it in GitHub Desktop.
eZ Platform GraphQL prototype
{
  contentType(identifier: "image") {
    content {
      id
      name
      fields(identifier: "image") {
        value {
          ... on ImageFieldValue {
            uri
            variations(identifier: ["medium", "large"]) {
              uri
            }
          }
        }
      }
      locations {
        urlAliases {
          path
        }
      }
    }
  }
}
{
  content (id: 87) {
    fields {
      fieldDefIdentifier
      value {
        ... on TextLineFieldValue {
          value
        }
        ... on RichTextFieldValue {
          html5
        }
        ... on AuthorFieldValue {
          authors {
            name
            email
          }
        }
        ...on ImageFieldValue {
          uri
        }
      }
    }
  }
}
http://localhost:8001/graphql/?query={content(id:88){id,fields{fieldDefIdentifier,languageCode,value}}}
{
  "data": {
    "content": {
      "id": 88,
      "fields": [
        {
          "fieldDefIdentifier": "title",
          "languageCode": "eng-GB",
          "value": "eZ Platform and eZ Studio coming soon"
        },
        {
          "fieldDefIdentifier": "publication_date",
          "languageCode": "eng-GB",
          "value": "1442570400"
        },
        {
          "fieldDefIdentifier": "author",
          "languageCode": "eng-GB",
          "value": "Robert Kowalski"
        },
        {
          "fieldDefIdentifier": "intro",
          "languageCode": "eng-GB",
          "value": "\u003C?xml version=\u00221.0\u0022 encoding=\u0022UTF-8\u0022?\u003E\n\u003Csection xmlns=\u0022http:\/\/docbook.org\/ns\/docbook\u0022 xmlns:xlink=\u0022http:\/\/www.w3.org\/1999\/xlink\u0022 xmlns:ezxhtml=\u0022http:\/\/ez.no\/xmlns\/ezpublish\/docbook\/xhtml\u0022 xmlns:ezcustom=\u0022http:\/\/ez.no\/xmlns\/ezpublish\/docbook\/custom\u0022 version=\u00225.0-variant ezpublish-1.0\u0022\u003E\u003Cpara\u003EOur next generation content management solutions, eZ Platform and eZ Studio, are shaping up nicely, and the eZ team is working very hard to finish the first release...\u003C\/para\u003E\u003C\/section\u003E\n"
        },
        {
          "fieldDefIdentifier": "body",
          "languageCode": "eng-GB",
          "value": "\u003C?xml version=\u00221.0\u0022 encoding=\u0022UTF-8\u0022?\u003E\n\u003Csection xmlns=\u0022http:\/\/docbook.org\/ns\/docbook\u0022 xmlns:xlink=\u0022http:\/\/www.w3.org\/1999\/xlink\u0022 xmlns:ezxhtml=\u0022http:\/\/ez.no\/xmlns\/ezpublish\/docbook\/xhtml\u0022 xmlns:ezcustom=\u0022http:\/\/ez.no\/xmlns\/ezpublish\/docbook\/custom\u0022 version=\u00225.0-variant ezpublish-1.0\u0022\u003E\u003Cpara\u003EOur next generation content management solutions, eZ Platform and eZ Studio, are shaping up nicely, and the eZ team is working very hard to finish the first release.\u003C\/para\u003E\u003Cpara\u003EWe planned to deliver beta and stable releases a little bit earlier but building the new platform as we want it is taking more energy and time than we expected; the last thing we want to do is release a half-baked product.\u003C\/para\u003E\u003Cpara\u003EEarlier this week we released a new alpha of eZ Platform, as well as a beta of 5.4.5 which includes new search capabilities and a re-engineering of eZ Recommendation Service. We are definitely getting closer and a lot of things are moving quickly now in the finalization of features.\u003C\/para\u003E\u003Cpara\u003E\u003Cemphasis role=\u0022strong\u0022\u003EA look at our timeline\u003C\/emphasis\u003E\u003C\/para\u003E\u003Cpara\u003EAt this point, we aim to release the beta for eZ Platform and eZ Studio at the beginning of October. By nature, eZ Platform will be a public beta and eZ Studio will be a private one, in which we will provide guidance together with access to the beta software.\u003C\/para\u003E\u003Cpara\u003EFollowing the beta release, we plan to have a first stable fast-track release (FTR) by early November. Our fast-track release path is the quick route to eZ\u0027s latest innovations. FTRs will be rolled out every two months, and eZ will support each one until the next FTR is introduced. Customers should anticipate upgrading to each new FTR to stay ahead of the curve and get continued support.\u003C\/para\u003E\u003Cpara\u003EFollowing the first stable release, eZ Platform and eZ Studio together will be available under the eZ Enterprise Subscription with support and maintenance services. The LTS release, which we intend to release in December, will be named by the forthcoming year: eZ Enterprise 2016.\u003C\/para\u003E\u003Cpara\u003EAnd when we mention we are definitely willing to provide something ready, this means not only software, but the services and knowledge around it. Together with the software, we are working on a new demo site, new tutorials and a training and enablement plan, as well as resources to tackle the transition from eZ Publish or eZ Publish Platform to eZ Platform and eZ Studio.\u003C\/para\u003E\u003Cpara\u003EIf you are eagerly awaiting for our new generation platform, we\u2019d be very happy to get in touch and listen to your expectations, answer any questions you might have and help you contribute to the beta! Please feel free to reach out to productmanagement@ez.no\u003C\/para\u003E\u003Cpara\u003E\u003Cemphasis role=\u0022strong\u0022\u003EStay tuned for more information on this blog.\u003C\/emphasis\u003E\u003C\/para\u003E\u003C\/section\u003E\n"
        },
        {
          "fieldDefIdentifier": "image",
          "languageCode": "eng-GB",
          "value": "blog2.jpg"
        }
      ]
    }
  }
}

Requires that you're logged in as admin. Use /login

mutation TestMutation {
  createSection(
    input: {
      clientMutationId: "createSection"
      identifier: "sometest"
      name: "somename"
    }
  ) {
    id
    identifier
    name
  }
}

Location

curl -X GET 'http://localhost:8000/graphql/?query={location(id:2){id,pathString,contentInfo{name}}}'
{
  "data": {
    "location": {
      "id": 2,
      "pathString": "\/1\/2\/",
      "contentInfo": {
        "name": "eZ Platform",
        "contentType": {
          "identifier": "folder"
        }
      }
    }
  }
}

Location with ContentType's field definitions

http://localhost:8001/graphql/?query={location(id:63){id,pathString,contentInfo{contentType{fieldDefinitions{identifier,fieldTypeIdentifier}}}}}
{
  "data": {
    "location": {
      "id": 63,
      "pathString": "\/1\/2\/61\/63\/",
      "contentInfo": {
        "contentType": {
          "fieldDefinitions": [
            {
              "identifier": "name",
              "fieldTypeIdentifier": "ezstring"
            },
            {
              "identifier": "caption",
              "fieldTypeIdentifier": "ezrichtext"
            },
            {
              "identifier": "image",
              "fieldTypeIdentifier": "ezimage"
            }
          ]
        }
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment