ASP.NET Minimal API Backend
This backend example keeps the PlaceField secret key on the server and exposes a local /api/locations/autocomplete route for your app.
Run Locally
cd examples/aspnet-minimal-api dotnet run
Open http://localhost:5187/. In Visual Studio, open PlaceField.AspNetMinimalApiExample.sln and click Start Debugging.
Configure The Key
Replace the placeholder in appsettings.json when you want real PlaceField results:
{
"PlaceField": {
"SecretKey": "pf_live_xxx",
"AutocompleteUrl": "https://api.placefield.dev/v1/locations/autocomplete"
}
}
What The Server Does
- Validates
qbefore calling PlaceField. - Forwards only known autocomplete parameters.
- Sends
Authorization: Bearer pf_live_xxxfrom the backend. - Passes through PlaceField status codes, JSON,
Retry-After, and API version headers.
This static guide does not call the PlaceField API. Clone the repo and run the server locally to test with your key.