@salesforce/b2c-tooling-sdk / clients / createScapiSchemasClient
Function: createScapiSchemasClient()
createScapiSchemasClient(
config,auth):ScapiSchemasClient
Defined in: packages/b2c-tooling-sdk/src/clients/scapi-schemas.ts:178
Creates a typed SCAPI Schemas API client.
Returns the openapi-fetch client directly, with authentication handled via middleware. This gives full access to all openapi-fetch features with type-safe paths, parameters, and responses.
The client automatically handles OAuth scope requirements:
- Domain scope:
sfcc.scapi-schemas(or custom via config.scopes) - Tenant scope:
SALESFORCE_COMMERCE_API:{tenantId}
Parameters
config
SCAPI Schemas client configuration including shortCode and tenantId
auth
Authentication strategy (typically OAuth)
Returns
Typed openapi-fetch client
Example
ts
// Create SCAPI Schemas client - scopes are handled automatically
const oauthStrategy = new OAuthStrategy({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
});
const client = createScapiSchemasClient(
{ shortCode: 'kv7kzm78', tenantId: 'zzxy_prd' },
oauthStrategy
);
// List available SCAPI schemas
const { data, error } = await client.GET('/organizations/{organizationId}/schemas', {
params: {
path: { organizationId: toOrganizationId('zzxy_prd') }
}
});
// Get a specific schema
const { data: schema } = await client.GET(
'/organizations/{organizationId}/schemas/{apiFamily}/{apiName}/{apiVersion}',
{
params: {
path: {
organizationId: toOrganizationId('zzxy_prd'),
apiFamily: 'shopper',
apiName: 'products',
apiVersion: 'v1'
},
query: { expand: 'custom_properties' }
}
}
);