API: Query publication as a root object
complete
Nicolas Fränkel
At the moment, you can use the GraphQL API and query for a _user_ and their _followerCount_:
query{
user(username: "nfrankel") {
numFollowing
}
}
However, I’d like to do the same for my _publication_. But publication is not part of the root query object. Please make it available.
Log In
Sandro Volpicella
complete
Hi Nicolas Fränkel
this is possible with our new API. The playground is available here: https://gql.hashnode.com
We also have a beta program in case you want to help us building some cool APIs :) https://townhall.hashnode.com/hashnode-public-apis-2-closed-beta
Here is an example query:
{
publication(host: "blog.awsfundamentals.com") {
posts(first: 2) {
edges {
node {
title
subtitle
}
}
}
}
}
Please let me know if that doesn't solve your query! :)
Nicolas Fränkel
Sandro Volpicella: Hello,
It's exactly what I wanted:
query {
publication(host: "apisix.hashnode.dev") {
followersCount
}
}
Result:
{
"data": {
"publication": {
"followersCount": 112
}
}
}
Thanks for your work!
Sandro Volpicella
Hi Nicolas Fränkel
this is possible with our new API. The playground is available here: https://gql.hashnode.com
We also have a beta program in case you want to help us building some cool APIs :) https://townhall.hashnode.com/hashnode-public-apis-2-closed-beta
Here is an example query:
{
publication(host: "blog.awsfundamentals.com") {
posts(first: 2) {
edges {
node {
title
subtitle
}
}
}
}
}
Nicolas Fränkel
Sandro Volpicella: Thanks! I'm currently on a business trip, but I'll check when I get back home.
Kavir
in progress
Hi Nicolas Fränkel we're working on improvements to our APIs and will provide an update on this soon!
Nicolas Fränkel
Kavir: thanks!