Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'
const client = createAdminClient({
baseUrl: 'https://your-store.com',
secretKey: 'sk_xxx',
})
// What a definition can be attached to. Comes from the server's registry, so
// a resource an extension adds shows up here without a client release.
const { data: resourceTypes } = await client.customFieldDefinitions.resourceTypes()spree api get /custom_field_definitions/resource_types{
"data": [
{
"resource_type": "address",
"name": "Addresses"
},
{
"resource_type": "category",
"name": "Categories"
},
{
"resource_type": "claim",
"name": "Claims"
},
{
"resource_type": "collection",
"name": "Collections"
},
{
"resource_type": "company",
"name": "Companies"
},
{
"resource_type": "credit_card",
"name": "Credit Cards"
},
{
"resource_type": "customer",
"name": "Customers"
},
{
"resource_type": "delivery_method",
"name": "Delivery Methods"
},
{
"resource_type": "exchange",
"name": "Exchanges"
},
{
"resource_type": "fulfillment",
"name": "Fulfillments"
},
{
"resource_type": "gift_card",
"name": "Gift Cards"
},
{
"resource_type": "line_item",
"name": "Line Items"
},
{
"resource_type": "media",
"name": "Media"
},
{
"resource_type": "newsletter_subscriber",
"name": "Newsletter Subscribers"
},
{
"resource_type": "option_type",
"name": "Option Types"
},
{
"resource_type": "option_value",
"name": "Option Values"
},
{
"resource_type": "order",
"name": "Orders"
},
{
"resource_type": "payment_method",
"name": "Payment Methods"
},
{
"resource_type": "payment_source",
"name": "Payment Sources"
},
{
"resource_type": "payment",
"name": "Payments"
},
{
"resource_type": "product_type",
"name": "Product Types"
},
{
"resource_type": "product",
"name": "Products"
},
{
"resource_type": "promotion",
"name": "Promotions"
},
{
"resource_type": "purchase_order",
"name": "Purchase Orders"
},
{
"resource_type": "refund",
"name": "Refunds"
},
{
"resource_type": "return",
"name": "Returns"
},
{
"resource_type": "seller",
"name": "Sellers"
},
{
"resource_type": "stock_level",
"name": "Stock Levels"
},
{
"resource_type": "stock_transfer",
"name": "Stock Transfers"
},
{
"resource_type": "store_credit",
"name": "Store Credits"
},
{
"resource_type": "store",
"name": "Stores"
},
{
"resource_type": "tax_rate",
"name": "Tax Rates"
},
{
"resource_type": "variant",
"name": "Variants"
}
]
}List what custom fields can be attached to
The resources a definition can describe, from the server’s own
registry (Spree.custom_fields.enabled_resources).
Read this rather than carrying a list: a resource an extension
registers appears here without a client release, and a resource_type
that is not listed is refused on create.
resource_type is the value to send; name is what a merchant calls
it — send the value back verbatim rather than deriving it from the name.
Required scope: read_settings (for API-key authentication).
GET
/
api
/
v3
/
admin
/
custom_field_definitions
/
resource_types
Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'
const client = createAdminClient({
baseUrl: 'https://your-store.com',
secretKey: 'sk_xxx',
})
// What a definition can be attached to. Comes from the server's registry, so
// a resource an extension adds shows up here without a client release.
const { data: resourceTypes } = await client.customFieldDefinitions.resourceTypes()spree api get /custom_field_definitions/resource_types{
"data": [
{
"resource_type": "address",
"name": "Addresses"
},
{
"resource_type": "category",
"name": "Categories"
},
{
"resource_type": "claim",
"name": "Claims"
},
{
"resource_type": "collection",
"name": "Collections"
},
{
"resource_type": "company",
"name": "Companies"
},
{
"resource_type": "credit_card",
"name": "Credit Cards"
},
{
"resource_type": "customer",
"name": "Customers"
},
{
"resource_type": "delivery_method",
"name": "Delivery Methods"
},
{
"resource_type": "exchange",
"name": "Exchanges"
},
{
"resource_type": "fulfillment",
"name": "Fulfillments"
},
{
"resource_type": "gift_card",
"name": "Gift Cards"
},
{
"resource_type": "line_item",
"name": "Line Items"
},
{
"resource_type": "media",
"name": "Media"
},
{
"resource_type": "newsletter_subscriber",
"name": "Newsletter Subscribers"
},
{
"resource_type": "option_type",
"name": "Option Types"
},
{
"resource_type": "option_value",
"name": "Option Values"
},
{
"resource_type": "order",
"name": "Orders"
},
{
"resource_type": "payment_method",
"name": "Payment Methods"
},
{
"resource_type": "payment_source",
"name": "Payment Sources"
},
{
"resource_type": "payment",
"name": "Payments"
},
{
"resource_type": "product_type",
"name": "Product Types"
},
{
"resource_type": "product",
"name": "Products"
},
{
"resource_type": "promotion",
"name": "Promotions"
},
{
"resource_type": "purchase_order",
"name": "Purchase Orders"
},
{
"resource_type": "refund",
"name": "Refunds"
},
{
"resource_type": "return",
"name": "Returns"
},
{
"resource_type": "seller",
"name": "Sellers"
},
{
"resource_type": "stock_level",
"name": "Stock Levels"
},
{
"resource_type": "stock_transfer",
"name": "Stock Transfers"
},
{
"resource_type": "store_credit",
"name": "Store Credits"
},
{
"resource_type": "store",
"name": "Stores"
},
{
"resource_type": "tax_rate",
"name": "Tax Rates"
},
{
"resource_type": "variant",
"name": "Variants"
}
]
}Authorizations
Secret API key for admin access
JWT token for admin user authentication
Response
200 - application/json
resource types found
Show child attributes
Show child attributes
Was this page helpful?
⌘I

