How to get the publications based on names?

There is a graphql query which returns all publications. Particularly, I’m interested in the Online Store publication since I want to publish some products there programmatically.

How can I tell when I get the list of nodes, which is which?

query {
  publications(first: 250, catalogType: APP) {
    edges {
      node {
        id
        catalog {
          id
          title
          status
        }
        name
      }
    }
  }
}

In addition, the documentation says that publication.name is deprecated and publication.catalog.title should be used instead. However, I found out (in the hard way), that the value is not consistent. On some shops, the catalog title contains the publication names, on others it doesn’t.

For example, this is a result:

{
  "id": "gid://shopify/Publication/<id1>",
  "catalog": {
    "id": "gid://shopify/AppCatalog/<id2>",
    "title": "Channel Catalog <id3> <uuid>",
    "status": "ACTIVE"
  },
  "name": "Online Store"
}

How can I identify that this particular publication is the right one for my Online Store channel?

1 Like

Hi Stefan,

Would the technique described here for for you? Retrieving publication name from API not possible - #12 by Liam-Shopify

1 Like

Looks good. Can you please push internally to add this as an example for the publications query, or point there to the catalogs query. I think this is a common use case and it was hard to find the right way to do it.