GraphQL
GraphQL Endpoint
Execute GraphQL queries for advanced data retrieval and search
Request
AuthorizationstringheaderrequiredBearer token for authentication
querystringbodyrequiredThe GraphQL query string
variablesobjectbodyVariables for the GraphQL query
operationNamestringbodyName of the operation to execute (for queries with multiple operations)
Response
dataobjectQuery results (structure depends on the query)
errorsarrayArray of error objects if any errors occurred
Request Example
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "query SearchSessions($query: String!) { searchSessions(query: $query, limit: 10) { total results { id name rank } } }",
"variables": {"query": "authentication bug fix"}
}' \
https://cloud.specstory.com/api/v1/graphqlconst response = await fetch('https://cloud.specstory.com/api/v1/graphql', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: `
query SearchSessions($query: String!) {
searchSessions(query: $query, limit: 10) {
total
results {
id
name
rank
}
}
}
`,
variables: {
query: 'authentication bug fix'
}
})
});
const data = await response.json();import requests
query = """
query SearchSessions($query: String!) {
searchSessions(query: $query, limit: 10) {
total
results {
id
name
rank
}
}
}
"""
variables = {
"query": "authentication bug fix"
}
response = requests.post(
'https://cloud.specstory.com/api/v1/graphql',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={'query': query, 'variables': variables}
)
data = response.json()Response Example
{
"data": {
"searchSessions": {
"total": 3,
"results": [
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"name": "Fix authentication token validation",
"rank": 0.95
},
{
"id": "550e8400-e29b-41d4-a716-446655440002",
"name": "Debug login authentication flow",
"rank": 0.87
},
{
"id": "550e8400-e29b-41d4-a716-446655440003",
"name": "Implement OAuth authentication",
"rank": 0.72
}
]
}
}
}{
"success": false,
"error": "Invalid GraphQL query or variables"
}{
"success": false,
"error": "Invalid or missing authentication token"
}