Skip to content

Commit c50e002

Browse files
committed
Add GraphQL API usage and integration details to README
Added documentation for the GraphQL API, including endpoints, example queries, and integration benefits. This provides guidance for developers on how to use and integrate the new GraphQL functionality alongside the existing REST API.
1 parent aca31dc commit c50e002

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.adoc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,54 @@ curl -X POST "http://localhost:2700/api/sn/MySite" \
173173
}]
174174
}'
175175
----
176+
=== GraphQL API Example
177+
178+
=== API Endpoints
179+
180+
- **GraphQL API**: `POST /graphql`
181+
- **GraphiQL Interface**: `GET /graphiql`
182+
183+
=== Example Usage
184+
185+
[source,graphql]
186+
----
187+
query {
188+
siteSearch(
189+
siteName: "your-site-name"
190+
searchParams: {
191+
q: "technology"
192+
rows: 10
193+
p: 1
194+
sort: "relevance"
195+
}
196+
locale: "en"
197+
) {
198+
queryContext {
199+
count
200+
responseTime
201+
}
202+
results {
203+
numFound
204+
document {
205+
fields {
206+
title
207+
text
208+
url
209+
}
210+
}
211+
}
212+
}
213+
}
214+
----
215+
216+
=== Integration Benefits
217+
218+
1. **Type Safety**: Strong typing prevents runtime errors
219+
2. **Flexible Queries**: Clients can request exactly the data they need
220+
3. **Single Endpoint**: All search operations through one GraphQL endpoint
221+
4. **Backward Compatibility**: Existing REST API remains unchanged
222+
5. **Interactive Development**: GraphiQL interface for query development
223+
6. **Consistent Results**: Uses same search engine and processing as REST API
176224

177225
== 🛠️ Development Setup
178226

0 commit comments

Comments
 (0)