Google Services
This section outlines the integration with various Google services, including Geocoding, Translation, and Place Suggestions, through our API. Access to these services requires proper authentication and adheres to specific request methodologies.
Authentication
To utilize these services, an appid
parameter is required for every request, serving as a primary method of authentication. This appid
functions as a developer key that is unique to each user.
Two-Factor Authentication (2FA)
- Requirement: Developers must enroll in Caner Developer to obtain and use an
appid
. - Validation: Requests are validated against the provided
appid
. If theappid
does not match or if 2FA validation fails, a401
status code is returned.
Services Overview
Geocoding
Convert addresses into geographic coordinates (latitude/longitude).
Request Method
- GET
Parameters
addr
- The address to geocode.lang
- (Optional) Language for results (default:zh-CN
).
Example
Translation
Translate text from one language to another.
Request Methods
- GET for simple queries.
- POST for larger text bodies or sensitive requests.
Parameters
text
- Text to translate.target
- (Optional) Target language (default:zh-CN
).
Examples
POST /api/translate
Headers: Content-Type: application/x-www-form-urlencoded
Body: appid=YOUR_APPID&text=Hello, world!&target=zh-CN
Place Suggestions
Get suggestions for places based on input text.
Request Method
- GET
Parameters
input
- Text input for place suggestions.type
- (Optional)pac
for place autocomplete,qac
for query autocomplete (default:pac
).lang
- (Optional) Language for results (default:zh-CN
).
Example
Error Handling
Standardized error codes and messages are included in each service response for troubleshooting, following common HTTP status code practices.
Replace YOUR_APPID
with your actual appid
provided after enrolling in Caner Developer and setting up 2FA.