Geolocation by Name API
POST /geolocationByName
Description
This API endpoint retrieves details for a specific geolocation based on its name.
Request Body
The request uses GraphQL to perform the geolocationByName
query, which requires a name
parameter.
Query:
query geolocationByName ($name: String!) {
geolocationByName (name: $name) {
id
name
code
threeCharCode
geoDiscount
}
}
GraphQL Variables:
{
"name": ""
}
Example Request:
curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query geolocationByName ($name: String!) {\n geolocationByName (name: $name) {\n id\n name\n code\n threeCharCode\n geoDiscount\n }\n}","variables":{"name":""}}'
Response:
-
Success (200 OK):
- The response includes details about the specified geolocation.
{
"data": {
"geolocationByName": {
"id": 1,
"name": "New York",
"code": "NY",
"threeCharCode": "NYC",
"geoDiscount": 5
}
}
}id
: Unique identifier for the geolocation.name
: Name of the location.code
: Two-letter code for the location.threeCharCode
: Three-letter code for the location.geoDiscount
: Discount percentage associated with the location.
-
Error (4XX/5XX):
- If there is an issue with the request (e.g., the specified name does not exist) or server error, the response will include an error message and status code.
Note:
This endpoint is useful for retrieving specific information about a geolocation using its name. Ensure the name provided exactly matches an existing geolocation to get accurate results.