IDevicesApi devicesApi = client.DevicesApi;
DevicesApi
List devices associated with the merchant. Currently, only Terminal API devices are supported.
ListDevicesAsync(
string cursor = null,
string sortOrder = null,
int? limit = null,
string locationId = null)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
string |
Query, Optional | A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. See Pagination for more information. |
sortOrder |
string |
Query, Optional | The order in which results are listed. - ASC - Oldest to newest.- DESC - Newest to oldest (default). |
limit |
int? |
Query, Optional | The number of results to return in a single page. |
locationId |
string |
Query, Optional | If present, only returns devices at the target location. |
Task<Models.ListDevicesResponse>
try
{
ListDevicesResponse result = await devicesApi.ListDevicesAsync();
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Lists all DeviceCodes associated with the merchant.
ListDeviceCodesAsync(
string cursor = null,
string locationId = null,
string productType = null,
string status = null)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
string |
Query, Optional | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See Paginating results for more information. |
locationId |
string |
Query, Optional | If specified, only returns DeviceCodes of the specified location. Returns DeviceCodes of all locations if empty. |
productType |
string |
Query, Optional | If specified, only returns DeviceCodes targeting the specified product type. Returns DeviceCodes of all product types if empty. |
status |
string |
Query, Optional | If specified, returns DeviceCodes with the specified statuses. Returns DeviceCodes of status PAIRED and UNPAIRED if empty. |
Task<Models.ListDeviceCodesResponse>
try
{
ListDeviceCodesResponse result = await devicesApi.ListDeviceCodesAsync();
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected terminal mode.
CreateDeviceCodeAsync(
Models.CreateDeviceCodeRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateDeviceCodeRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.CreateDeviceCodeResponse>
CreateDeviceCodeRequest body = new CreateDeviceCodeRequest.Builder(
"01bb00a6-0c86-4770-94ed-f5fca973cd56",
new DeviceCode.Builder(
"TERMINAL_API"
)
.Name("Counter 1")
.LocationId("B5E4484SHHNYH")
.Build()
)
.Build();
try
{
CreateDeviceCodeResponse result = await devicesApi.CreateDeviceCodeAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves DeviceCode with the associated ID.
GetDeviceCodeAsync(
string id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The unique identifier for the device code. |
Task<Models.GetDeviceCodeResponse>
string id = "id0";
try
{
GetDeviceCodeResponse result = await devicesApi.GetDeviceCodeAsync(id);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves Device with the associated device_id
.
GetDeviceAsync(
string deviceId)
Parameter | Type | Tags | Description |
---|---|---|---|
deviceId |
string |
Template, Required | The unique ID for the desired Device . |
Task<Models.GetDeviceResponse>
string deviceId = "device_id6";
try
{
GetDeviceResponse result = await devicesApi.GetDeviceAsync(deviceId);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}