For all of these queries you need the following permission:
Get tiers
Our API allows you to fetch tiers as a collection using getTiers
in our SDKs or the tiers
query in GraphQL. In both cases this endpoint supports Pagination.
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.getTiers({
first: 25,
});
if (res.error) {
console.error(res.error);
} else {
console.log(res.data);
}
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.getTiers({
first: 25,
});
if (res.error) {
console.error(res.error);
} else {
console.log(res.data);
}
query tiers($first: Int, $after: String, $last: Int, $before: String) {
tiers(first: $first, after: $after, last: $last, before: $before) {
edges {
cursor
node {
id
externalId
name
defaultPriority
}
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}
Get tier by ID
If you know the tiers’s ID in Plain you can use this method to fetch the tier.
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.getTierById({
tierId: 'tier_123',
});
if (res.error) {
console.error(res.error);
} else {
console.log(res.data);
}
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.getTierById({
tierId: 'tier_123',
});
if (res.error) {
console.error(res.error);
} else {
console.log(res.data);
}
query tier($tierId: ID!) {
tier(tierId: $tierId) {
id
externalId
name
defaultPriority
}
}