Skip to content

Instantly share code, notes, and snippets.

@jbaxleyiii
Created October 6, 2016 19:59
Show Gist options
  • Save jbaxleyiii/8cc4d454c06fa7a55bd7e363eeca8260 to your computer and use it in GitHub Desktop.
Save jbaxleyiii/8cc4d454c06fa7a55bd7e363eeca8260 to your computer and use it in GitHub Desktop.
GraphQL in Rock

Lava

<!-- Body -->
{% capture body %}{% raw %}
{
    "query": "
        query GetContentFromRock($channel: String!, $sizes: [String], $ratios: [String]){
            content(limit: 1, channel: $channel) {
                title
                content {
                images(sizes: $sizes, ratios: $ratios) {
                    url
                }
            }
          }
        }
    ",
    "variables": {
        "channel": "series_newspring",
        "sizes": ["medium"],
        "ratios": ["1:1"]
    }
}
{% endraw %}{% endcapture %}

{% webrequest method:'POST' url:'https://alpha-api.newspring.cc/graphql' body:'{{ body | StripNewlines }}' requestcontenttype:'application/json' %}
  <pre>{{ results | ToJSON }}</pre>
{% endwebrequest %}

Results

{
  "data": {
    "content": [
      {
        "title": "I Am: Jesus in His Own Words",
        "content": {
          "images": [
            {
              "url": "//drhztd8q3iayu.cloudfront.net/newspring/collection/series_newspring/69567.marketing.cen.web.iam_1x1.medium.png"
            }
          ]
        }
      }
    ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment