Experimental GraphQL API v2
Migrates your newsletters to GraphQL API v2.
This API is experimental, you should not use it without any advice from Sirius team.
Why GraphQL API v2
The v1 was designed when Sirius GraphQL API didn't exist. Today it is easier for a developer to use the same API everywhere.
Sirius GraphQL Newsletter API v2 is an extension of Sirius GraphQL API. It means that everything accessible on the Sirius GraphQL API is accessible in addition to some special fields like metadata
, articlesArea
or textArea
.
Migrate from v1
This guide will help you migrate your newsletters from v1 to v2.
Global IDs
Every id
are now global IDs, for example, @seed
directives now accept global IDs instead of numeric ids.
List of articles
To create a list of the article available in the edition interface, you must now use editionListBlock
.
API v1
{articlesArea(name: "area", limit: 1) {titleimage(width: 580, height: 387, aspectRatio: ratio_3x2) {urlaltwidthheight}}}
API v2
About feature image, in v2, you have to request URL and caption defined in the article and eventually fallback on the one defined in the image. If you need an aspect ratio, you can find the aspectRatioKey
in Sirius Aspect Ratios admin.
{editionListBlock(key: "area", softLimit: 1, accepts: [articles]) {iditems {id... on ArticleListItem {idarticle {titlefeatureImage {image {caption}captionurl(width: 580, height: 387, aspectRatioKey: "3:2")}}}}}}
Publication based query
API v1
query Query($digitalPublicationId: Int! = 41) {digitalPublication(id: $digitalPublicationId) {datearticles {title}}}
API v2
Edit this page on GitHubquery Query($editionId: ID! = "bG9jYWw6UHVibGljYXRpb246Mw==") {node(id: $editionId) {... on PeriodicalEdition {dateblocks {... on ListBlock {items {... on ArticleListItem {article {title}}}}}}}}