Creating a new internal custom field in administration panel
In this guide we will see how you can create a new custom field and how browse it with GraphQL API.
Introduction
For this example, we will see how to add a custom twitter username text field on Authors
Creating a new custom field
- Login to Sirius, if you don't have an account, ask a Sirius owner to create one for you.
- Be sure your user has the "customFields:full", usually the "Owner" role.
- Go to administration custom fields page. Administration ‣ Champs personnalisés
- Click Signataire then Créer un champ personnalisé
Update custom field value
- Once
twitter
had been created, go to the author page. Administration ‣ Signataires ‣ Pick one - Fill new twitter text custom field
- Save the author
twitter
from authors
Retrieve You can query this specific author's custom field by a simple call to the GraphQL API (see forming-calls and Author)
query Author {node(id: "c3RnLWxlbW9uZGU6Q3VzdG9tRmllbGQ6MzY=") {... on Author {idcustom {}}}}
With AuthorCustomFields
:
type AuthorCustomFields {twitter: String}
The result of this query is an Author
object with twitter
custom field as text
:
{"data": {"node": {"id": "c3RnLWxlbW9uZGU6Q3VzdG9tRmllbGQ6MzY=","custom": {"twitter": "@foobar"}}}}
Edit this page on GitHubAs you can see, types are generated automatically based on your Sirius configuration. Don't forget to check Sirius GraphQL Playground to see updated schema that displays custom fields.