ILocationsApi locationsApi = client.LocationsApi;
LocationsApi
Provides information of all locations of a business.
Most other Connect API endpoints have a required location_id
path parameter.
The id
field of the Location
objects returned by this
endpoint correspond to that location_id
parameter.
ListLocationsAsync()
Task<Models.ListLocationsResponse>
try
{
ListLocationsResponse result = await locationsApi.ListLocationsAsync();
}
catch (ApiException e){};
Creates a location. For more information about locations, see Locations API Overview.
CreateLocationAsync(Models.CreateLocationRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Models.CreateLocationRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.CreateLocationResponse>
var bodyLocationAddress = new Address.Builder()
.AddressLine1("1234 Peachtree St. NE")
.Locality("Atlanta")
.AdministrativeDistrictLevel1("GA")
.PostalCode("30309")
.Build();
var bodyLocation = new Location.Builder()
.Name("New location name")
.Address(bodyLocationAddress)
.Description("My new location.")
.Build();
var body = new CreateLocationRequest.Builder()
.Location(bodyLocation)
.Build();
try
{
CreateLocationResponse result = await locationsApi.CreateLocationAsync(body);
}
catch (ApiException e){};
Retrieves details of a location.
RetrieveLocationAsync(string locationId)
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
string |
Template, Required | The ID of the location to retrieve. |
Task<Models.RetrieveLocationResponse>
string locationId = "location_id4";
try
{
RetrieveLocationResponse result = await locationsApi.RetrieveLocationAsync(locationId);
}
catch (ApiException e){};
Updates a location.
UpdateLocationAsync(string locationId, Models.UpdateLocationRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
string |
Template, Required | The ID of the location to update. |
body |
Models.UpdateLocationRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateLocationResponse>
string locationId = "location_id4";
var bodyLocationAddress = new Address.Builder()
.AddressLine1("1234 Peachtree St. NE")
.Locality("Atlanta")
.AdministrativeDistrictLevel1("GA")
.PostalCode("30309")
.Build();
var bodyLocationBusinessHoursPeriods = new List<BusinessHoursPeriod>();
var bodyLocationBusinessHoursPeriods0 = new BusinessHoursPeriod.Builder()
.DayOfWeek("MON")
.StartLocalTime("09:00")
.EndLocalTime("17:00")
.Build();
bodyLocationBusinessHoursPeriods.Add(bodyLocationBusinessHoursPeriods0);
var bodyLocationBusinessHours = new BusinessHours.Builder()
.Periods(bodyLocationBusinessHoursPeriods)
.Build();
var bodyLocation = new Location.Builder()
.Name("Updated nickname")
.Address(bodyLocationAddress)
.BusinessHours(bodyLocationBusinessHours)
.Description("Updated description")
.TwitterUsername("twitter")
.InstagramUsername("instagram")
.Build();
var body = new UpdateLocationRequest.Builder()
.Location(bodyLocation)
.Build();
try
{
UpdateLocationResponse result = await locationsApi.UpdateLocationAsync(locationId, body);
}
catch (ApiException e){};