DevicesApi devicesApi = client.getDevicesApi();
DevicesApi
Lists all DeviceCodes associated with the merchant.
CompletableFuture<ListDeviceCodesResponse> listDeviceCodesAsync(
final String cursor,
final String locationId,
final String productType)
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. |
String cursor = "cursor6";
String locationId = "location_id4";
String productType = "TERMINAL_API";
devicesApi.listDeviceCodesAsync(cursor, locationId, productType).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected terminal mode.
CompletableFuture<CreateDeviceCodeResponse> createDeviceCodeAsync(
final 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. |
DeviceCode bodyDeviceCode = new DeviceCode.Builder(
"TERMINAL_API")
.id("id0")
.name("Counter 1")
.code("code8")
.deviceId("device_id6")
.locationId("B5E4484SHHNYH")
.build();
CreateDeviceCodeRequest body = new CreateDeviceCodeRequest.Builder(
"01bb00a6-0c86-4770-94ed-f5fca973cd56",
bodyDeviceCode)
.build();
devicesApi.createDeviceCodeAsync(body).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Retrieves DeviceCode with the associated ID.
CompletableFuture<GetDeviceCodeResponse> getDeviceCodeAsync(
final String id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The unique identifier for the device code. |
String id = "id0";
devicesApi.getDeviceCodeAsync(id).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});