Skip to content

Commit 2ca19b9

Browse files
committed
docs: clarify site_details includes navigation links
Updated FRONTEND_INTEGRATION.md to note that /site_details already includes top_nav_links and footer_links, eliminating the need for separate /links API calls in most cases. Also includes user-added tests for locale-prefixed API paths.
1 parent 525ba91 commit 2ca19b9

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

docs/api/FRONTEND_INTEGRATION.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,23 @@ export async function getSharedSiteDetails(Astro: AstroGlobal): Promise<SiteDeta
100100

101101
## Aggregated Data with `include=`
102102

103-
### Reduce API Calls
103+
### Important: `/site_details` Already Includes Links
104+
105+
The `/site_details` endpoint already includes navigation links:
106+
107+
```json
108+
{
109+
"company_display_name": "Demo Agency",
110+
"top_nav_links": [...],
111+
"footer_links": [...],
112+
"contact_info": {...},
113+
"social_links": {...}
114+
}
115+
```
116+
117+
This means **you don't need a separate call to `/links`** in most cases!
118+
119+
### Further Aggregation with `include=`
104120

105121
Instead of 5+ separate calls, use the `include=` parameter:
106122

spec/requests/api_public/v1/client_config_includes_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
expect(json["data"]).not_to have_key("site_details")
3939
end
4040

41+
it "accepts locale-prefixed path with includes" do
42+
host! 'client-config-test.example.com'
43+
get "/api_public/v1/en/client-config", params: { include: "translations" }
44+
expect(response).to have_http_status(200)
45+
json = response.parsed_body
46+
expect(json["data"]).to have_key("translations")
47+
end
48+
4149
context "with include=links" do
4250
it "includes links with placement" do
4351
host! 'client-config-test.example.com'

spec/requests/api_public/v1/properties_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@
9898
expect(response).to have_http_status(200)
9999
end
100100

101+
it "accepts locale-prefixed path" do
102+
host! 'properties-test.example.com'
103+
get "/api_public/v1/en/properties", params: { sale_or_rental: "sale" }
104+
expect(response).to have_http_status(200)
105+
json = response.parsed_body
106+
expect(json).to have_key("data")
107+
expect(response.headers["Vary"]).to include("Accept-Language")
108+
expect(response.headers["Vary"]).to include("X-Website-Slug")
109+
end
110+
101111
it "supports sort_by price_asc" do
102112
host! 'properties-test.example.com'
103113
get "/api_public/v1/properties", params: { sale_or_rental: "sale", sort_by: "price_asc" }

0 commit comments

Comments
 (0)