Skip to content

Latest commit

 

History

History
203 lines (133 loc) · 5.88 KB

LocationsApi.md

File metadata and controls

203 lines (133 loc) · 5.88 KB

SquareConnect.LocationsApi

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(body)

CreateLocation

Creates a location. For more information about locations, see Locations API Overview.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LocationsApi();

var body = new SquareConnect.CreateLocationRequest(); // CreateLocationRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.createLocation(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

CreateLocationResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

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

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LocationsApi();
apiInstance.listLocations().then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

This endpoint does not need any parameter.

Return type

ListLocationsResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveLocation

RetrieveLocationResponse retrieveLocation(locationId)

RetrieveLocation

Retrieves details of a location.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LocationsApi();

var locationId = "locationId_example"; // String | The ID of the location to retrieve.

apiInstance.retrieveLocation(locationId).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
locationId String The ID of the location to retrieve.

Return type

RetrieveLocationResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateLocation

Note: This endpoint is in beta.

UpdateLocationResponse updateLocation(locationId, body)

UpdateLocation

Updates a location.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.LocationsApi();

var locationId = "locationId_example"; // String | The ID of the location to update.

var body = new SquareConnect.UpdateLocationRequest(); // UpdateLocationRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.updateLocation(locationId, body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

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

UpdateLocationResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json