Anchor to staffMemberstaff
staffMember
query
The StaffMember resource, by ID.
Anchor to Arguments
Arguments
- •
The ID of the staff member to return. If no ID is provided, then the staff member making the query (if any) is returned.
Was this section helpful?
Anchor to Possible returnsPossible returns
- Anchor to StaffMemberStaff•
Member Represents the data about a staff member's Shopify account. Merchants can use staff member data to get more information about the staff members in their store.
Was this section helpful?
- Retrieves a single user
- Retrieves the currently logged-in user
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query StaffMember($id: ID!) {6 staffMember(id: $id) {7 active8 avatar {9 url10 }11 email12 exists13 firstName14 id15 initials16 isShopOwner17 lastName18 locale19 name20 phone21 }22 }`,23 {24 variables: {25 "id": "gid://shopify/StaffMember/902541635"26 },27 },28);2930const data = await response.json();31
query StaffMember($id: ID!) {
staffMember(id: $id) {
active
avatar {
url
}
email
exists
firstName
id
initials
isShopOwner
lastName
locale
name
phone
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query StaffMember($id: ID!) { staffMember(id: $id) { active avatar { url } email exists firstName id initials isShopOwner lastName locale name phone } }",
"variables": {
"id": "gid://shopify/StaffMember/902541635"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query StaffMember($id: ID!) {
staffMember(id: $id) {
active
avatar {
url
}
email
exists
firstName
id
initials
isShopOwner
lastName
locale
name
phone
}
}`,
{
variables: {
"id": "gid://shopify/StaffMember/902541635"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `query StaffMember($id: ID!) {
staffMember(id: $id) {
active
avatar {
url
}
email
exists
firstName
id
initials
isShopOwner
lastName
locale
name
phone
}
}`,
"variables": {
"id": "gid://shopify/StaffMember/902541635"
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query StaffMember($id: ID!) {
staffMember(id: $id) {
active
avatar {
url
}
email
exists
firstName
id
initials
isShopOwner
lastName
locale
name
phone
}
}
QUERY
variables = {
"id": "gid://shopify/StaffMember/902541635"
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "id": "gid://shopify/StaffMember/902541635"3}
Response
JSON1{2 "staffMember": {3 "active": true,4 "avatar": {5 "url": "https://cdn.shopify.com/s/files/1/2637/1970/users/foo.jpg?v=1731443626"6 },7 "email": "bob@example.com",8 "exists": true,9 "firstName": "bob",10 "id": "gid://shopify/StaffMember/902541635",11 "initials": [12 "b",13 "b"14 ],15 "isShopOwner": true,16 "lastName": "bobsen",17 "locale": "en",18 "name": "bob bobsen",19 "phone": null20 }21}