Square.Connect.Api.LocationsApi
November 20, 2019 ยท View on GitHub
All URIs are relative to https://connect.squareup.com
| Method | HTTP request | Description |
|---|---|---|
| CreateLocation | POST /v2/locations | CreateLocation |
| ListLocations | GET /v2/locations | ListLocations |
| RetrieveLocation | GET /v2/locations/{location_id} | RetrieveLocation |
| UpdateLocation | PUT /v2/locations/{location_id} | UpdateLocation |
CreateLocation
Note: This endpoint is in beta.
CreateLocationResponse CreateLocation (CreateLocationRequest body)
CreateLocation
Creates a location. For more information about locations, see Locations API Overview.
Example
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class CreateLocationExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new LocationsApi();
var body = new CreateLocationRequest(); // CreateLocationRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// CreateLocation
CreateLocationResponse result = apiInstance.CreateLocation(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling LocationsApi.CreateLocation: " + e.Message );
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| body | CreateLocationRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListLocations
ListLocationsResponse ListLocations ()
ListLocations
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.
Example
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class ListLocationsExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new LocationsApi();
try
{
// ListLocations
ListLocationsResponse result = apiInstance.ListLocations();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling LocationsApi.ListLocations: " + e.Message );
}
}
}
}
Parameters
This endpoint does not need any parameter.
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RetrieveLocation
RetrieveLocationResponse RetrieveLocation (string locationId)
RetrieveLocation
Retrieves details of a location.
Example
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class RetrieveLocationExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new LocationsApi();
var locationId = locationId_example; // string | The ID of the location to retrieve.
try
{
// RetrieveLocation
RetrieveLocationResponse result = apiInstance.RetrieveLocation(locationId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling LocationsApi.RetrieveLocation: " + e.Message );
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| locationId | string | The ID of the location to retrieve. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdateLocation
Note: This endpoint is in beta.
UpdateLocationResponse UpdateLocation (string locationId, UpdateLocationRequest body)
UpdateLocation
Updates a location.
Example
using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;
namespace Example
{
public class UpdateLocationExample
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new LocationsApi();
var locationId = locationId_example; // string | The ID of the location to update.
var body = new UpdateLocationRequest(); // UpdateLocationRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try
{
// UpdateLocation
UpdateLocationResponse result = apiInstance.UpdateLocation(locationId, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling LocationsApi.UpdateLocation: " + e.Message );
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| locationId | string | The ID of the location to update. | |
| body | UpdateLocationRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]