Skip to content

Commit 921799a

Browse files
pbennett1-godaddywcole1-godaddy
authored andcommitted
adjust cli instructions for discovery use only
1 parent 2f604ef commit 921799a

1 file changed

Lines changed: 59 additions & 20 deletions

File tree

  • packages/react/skills/commerce-api

packages/react/skills/commerce-api/SKILL.md

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
name: commerce-api
33
description: >
44
Authenticate with the GoDaddy Commerce Platform using OAuth2 client
5-
credentials or JWT grants. Covers the /v2/oauth2/token endpoint,
6-
environments (ote, prod), required headers, and scopes. For API
7-
discovery, schema introspection, and testing use @godaddy/cli
8-
(godaddy api list, godaddy api describe, godaddy api call). For
9-
checkout session creation use the Checkout API. Activate when an
10-
agent needs to obtain an OAuth token, configure commerce API auth,
11-
create checkout sessions, or discover available commerce endpoints.
5+
credentials. Covers the /v2/oauth2/token endpoint, environments
6+
(ote, prod), required headers, scopes, and monetary value formats.
7+
Always collect client ID, client secret, store ID, and environment
8+
from the user before making API calls. For API discovery and schema
9+
introspection use @godaddy/cli (godaddy api list, godaddy api
10+
describe, godaddy api search) to find endpoints and required scopes.
11+
For checkout session creation use the Checkout API.
1212
type: core
1313
library: "@godaddy/react"
1414
sources:
@@ -19,8 +19,16 @@ sources:
1919

2020
## Setup
2121

22-
Connecting to the GoDaddy Commerce Platform requires an OAuth client ID,
23-
client secret, and a store ID (UUID).
22+
Connecting to the GoDaddy Commerce Platform requires three pieces of
23+
information from the user. **Always ask for these before making any API
24+
calls:**
25+
26+
1. **OAuth client ID** and **client secret** — from their GoDaddy app
27+
2. **Store ID** (UUID) — identifies the merchant store
28+
3. **Environment**`ote` or `prod` (if not specified, default to `ote`)
29+
30+
If the user provides a custom API host (e.g., for an internal environment),
31+
use it directly instead of the mappings below.
2432

2533
**Environments:**
2634

@@ -72,22 +80,30 @@ const headers = {
7280
};
7381
```
7482

75-
**OAuth scopes** — request only the scopes your application needs. If a
76-
scope is not provisioned for your OAuth app, the token request returns
77-
`invalid_scope`.
83+
**OAuth scopes** — request only the scopes your application needs. Use
84+
`godaddy api describe <endpoint>` to find the exact scopes required for
85+
each endpoint. If a scope is not provisioned for your OAuth app, the
86+
token request returns `invalid_scope`.
7887

7988
| Scope | Purpose |
8089
|--------------------------|----------------------------------|
8190
| `commerce.product:read` | Read catalog/SKU data |
8291
| `commerce.product:write` | Create and update catalog data |
8392
| `commerce.order:read` | Read order data |
8493

94+
**Monetary values** — all money amounts in API responses are in **minor
95+
units** (cents). For example, `"value": 2500` with `"currencyCode": "USD"`
96+
means **$25.00**, not $2,500. Always divide by 100 for USD display.
97+
8598
## Core Patterns
8699

87100
### Discover APIs with @godaddy/cli
88101

89102
Use the `@godaddy/cli` package (https://www.npmjs.com/package/@godaddy/cli)
90-
to discover available endpoints, inspect schemas, and test API calls.
103+
to discover available endpoints, inspect their schemas, and identify
104+
required scopes. The CLI is a **discovery tool only** — use the OAuth
105+
token (see Setup above) to make actual API calls in your application code.
106+
91107
Install globally from the npm public registry:
92108

93109
```bash
@@ -108,18 +124,41 @@ godaddy api list --domain orders
108124
godaddy api search checkout
109125
godaddy api search tax
110126

111-
# Describe an endpoint's schema, parameters, and scopes
127+
# Describe an endpoint's schema, parameters, and required scopes
112128
godaddy api describe /location/addresses
113-
114-
# Make an authenticated API call
115-
# Note: Most commerce endpoints require {storeId} in the path
116-
godaddy api call /v2/commerce/stores/{storeId}/catalog-subgraph -s commerce.product:read
117-
godaddy api call /v1/commerce/stores/{storeId}/orders -s commerce.order:read
129+
godaddy api describe /v1/commerce/stores/{storeId}/orders
118130
```
119131

120132
All CLI commands return structured JSON with `next_actions` that suggest
121133
what to run next. Use `godaddy api describe` to inspect request/response
122-
schemas and required scopes before implementing API calls in code.
134+
schemas and required scopes, then use that information to make
135+
authenticated requests with your OAuth token.
136+
137+
**Example: calling the orders API directly using the discovered path and scopes**
138+
139+
```typescript
140+
// 1. Discover: `godaddy api describe /v1/commerce/stores/{storeId}/orders`
141+
// tells us: GET, scope commerce.order:read, storeId required in path
142+
//
143+
// 2. Request a token with the required scope (see Setup)
144+
// 3. Call the API directly:
145+
const response = await fetch(
146+
`https://${host}/v1/commerce/stores/${storeId}/orders`,
147+
{
148+
method: 'GET',
149+
headers: {
150+
'Authorization': `Bearer ${token}`,
151+
'Content-Type': 'application/json',
152+
'x-store-id': storeId,
153+
},
154+
}
155+
);
156+
```
157+
158+
> **Note:** Most commerce endpoints require `{storeId}` in the path
159+
> (e.g., `/v1/commerce/stores/{storeId}/orders`,
160+
> `/v2/commerce/stores/{storeId}/catalog-subgraph`). Always check the
161+
> endpoint schema with `godaddy api describe` before implementing.
123162
124163
### Create and Update Checkout Sessions
125164

0 commit comments

Comments
 (0)