CData Cloud は、クラウドホスト型のソリューションで、複数の標準サービスやプロトコルにまたがるSquare へのアクセスを実現します。MySQL またはSQL Server データベースに接続できるアプリケーションであれば、CData Cloud を介してSquare に接続できます。
CData Cloud により、他のOData エンドポイントや標準SQL Server / MySQL データベースと同じように、Square への接続を標準化し、構成することができます。
このページでは、CData Cloud でのSquare への接続の確立 のガイド、利用可能なリソースに関する情報、および使用可能な接続プロパティのリファレンスについて説明します。
接続の確立 は、CData Cloud にデータベースを作成するためのSquare への認証方法と必要な接続プロパティの設定方法について示します。
利用可能な標準サービスを経由してSquare からデータにアクセスする方法と、CData Cloud の管理については、CData Cloud ドキュメント で詳しく説明します。
Database タブで対応するアイコンを選択して、Square に接続します。必須プロパティはSettings にリストされています。Advanced タブには、通常は必要ない接続プロパティが表示されます。
上記のいずれの方法も、CData Square ドライバーに組み込まれたOAuth 機能を使用します。
接続の前に
サンドボックスに接続するには、サンドボックスのアクセストークンを取得してOAuthAccessToken 接続プロパティをそのトークンに設定します。
以下のサブセクションでは、3つの一般的な認証フローでのSquare への認証について詳しく説明します。
カスタムOAuth アプリケーションの作成方法と、組み込みOAuth 認証情報を持つ認証フローでもカスタムOAuth アプリケーションを作成したほうがよい場合の説明については、カスタムOAuth アプリケーションの作成 を参照してください。
Square で利用可能な接続文字列プロパティの全リストは、Connection を参照してください。
アクセストークンの期限が切れたときは、Cloud は自動でアクセストークンをリフレッシュします。
OAuth アクセストークンの自動リフレッシュ:
Cloud がOAuth アクセストークンを自動的にリフレッシュするようにするには、次のように設定します。
OAuth アクセストークンの手動リフレッシュ:
OAuth アクセストークンを手動でリフレッシュするために必要な唯一の値は、OAuth リフレッシュトークンです。
OAuth リフレッシュトークンを保存し、OAuth アクセストークンの有効期限が切れた後に手動でリフレッシュできるようにします。
デフォルトでは、Cloud はサーバーの証明書をシステムの信頼できる証明書ストアと照合してSSL / TLS のネゴシエーションを試みます。
別の証明書を指定するには、利用可能なフォーマットについてSSLServerCert プロパティを参照してください。
Windows のシステムプロキシ経由の接続では、接続プロパティを追加で設定する必要はありません。他のプロキシに接続するには、ProxyAutoDetect をfalse に設定します。
さらにHTTP プロキシへの認証には、ProxyServer とProxyPort に加えてProxyAuthScheme、ProxyUser、およびProxyPassword を設定します。
次のプロパティを設定します。
The CData Cloud models the Square v1 and Square v2 APIs as relational tables, views, and stored procedures. These are defined in schema files, which are simple, text-based configuration files.
The available entities are documented in Square v1 データモデル and Square v2 Data Model.
The Cloud offloads as much of the SELECT statement processing as possible to the Square APIs and then processes the rest of the query within the Cloud. The following sections document API limitations, requirements, or particularities.
You can query tables/views from different business locations by specifying multiple LocationIds in the "IN" operator. Note however that for tables/views like Customers, Employees, Orders, and OrderItems, this is not possible.
SELECT * FROM Transactions WHERE LocationId IN ('CBASEDbVhLxAJeGrBRLi-BxZ3XcgAQ','CBASEGJDarn_hucmacLdA_iGNGwgAQ','CBASEFsuPlSmrLHXu9a5Lmlv4D4gAQ')
This section documents the ストアドプロシージャ available to connect to the Square v1 APIs.
ストアドプロシージャはファンクションライクなインターフェースで、Square の単純なSELECT/INSERT/UPDATE/DELETE 処理にとどまらずCloud の機能を拡張します。
ストアドプロシージャは、パラメータのリストを受け取り、目的の機能を実行し、プロシージャが成功したか失敗したかを示すとともにSquare から関連するレスポンスデータを返します。
Name | Description |
ApplyFeeToItem | Apply a Fee to an Item. |
RemoveFeeFromItem | Remove a Fee from an Item. |
Apply a Fee to an Item.
Name | Type | Required | Description |
ItemId | String | True | The item Id the fee will be applied to. |
FeeId | String | True | The fee Id that will be applied to the item. |
Name | Type | Description |
Result | String | Whether the fee was applied successfully. |
Remove a Fee from an Item.
Name | Type | Required | Description |
ItemId | String | True | The Id of the item the fee will be removed from. |
FeeId | String | True | The Id of the fee that will be removed from the item. |
Name | Type | Description |
Result | String | The Id of the item with the fee removed. |
This section documents the テーブル, ビュー, and ストアドプロシージャ available to connect to the Square v2 aPIs.
Cloud はSquare のデータを、標準のSQL ステートメントを使用してクエリできるリレーショナルデータベースのテーブルのリストとしてモデル化します。
Name | Description |
Cards | Create, update, delete, and query the available Cards in Square. |
CatalogCategories | Query the available catalog categories. |
CatalogDiscounts | Query the available catalog discounts. |
CatalogImages | Query the available catalog images. |
CatalogItems | Query the available items. |
CatalogItemVariations | Query the available item variations. |
CatalogModifierLists | Query the available catalog modifier lists. |
CatalogModifiers | Query the available catalog modifiers. |
CatalogTaxes | Query the available catalog taxes. |
CustomerCards | Create, update, delete, and query the available CustomerCards in Square. |
Customers | Create, update, delete, and query the available customers in Square. |
InventoryChanges | Query historical physical counts and adjustments on inventory items. |
Refunds | Create and query the details for all Refunds initiated by a merchant or any of the mobile staff of the merchant during a date range. |
Create, update, delete, and query the available Cards in Square.
The Cloud uses the Square API to process search criteria , while other filters are processed client side within the Cloud.
Select all Cards:
SELECT * FROM Cards
Select all Cards from a specific customer:
SELECT * FROM Cards WHERE CustomerId = 'CBASEPlKoFeu4nWm0MX_oHdklAIgAQ'
To create a card, you will need to specify CustomerId, IdempotencyKey and SourceId.
INSERT INTO Cards (IdempotencyKey, SourceId, CustomerId, BillingAddressAddressLine1, BillingAddressAddressLine2, BillingAddressLocality, BillingAddressPostalCode, BillingAddressCountry, CardholderName) VALUES ('aa8f236c-13a6-42fe-a17e-4edf6caa2035', 'fake-card-nonce-ok', 'CBASEPlKoFeu4nWm0MX_oHdklAIgAQ', '500 Electric Ave', 'Suite 600', 'New York', '94103', 'US', 'CardholderName')
A card can be removed by providing the Id.
DELETE FROM Cards WHERE Id = 'eKoFeu4nWm0MX_oed'
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
Unique ID for this card. Generated by Square. |
BillingAddressAddressLine1 | String | False |
A civil entity within the address's country. In the US, this is the state. |
BillingAddressAddressLine2 | String | False |
The second line of the address, if any. |
BillingAddressAddressLine3 | String | False |
The third line of the address, if any |
BillingAddressAdministrativeDistrictLevel1 | String | False |
A civil entity within the address's country. |
BillingAddressCountry | String | False |
The address's country, in the two-letter format of ISO 3166. |
BillingAddressLocality | String | False |
The city or town of the address. |
BillingAddressSubLocality | String | False |
A civil region within the address's locality, if any. |
BillingAddressPostalCode | String | False |
The address's postal code. |
Bin | String | True |
The first six digits of the card number, known as the Bank Identification Number (BIN). |
CardBrand | String | True |
The card's brand. |
CardType | String | True |
The type of the card. |
CardholderName | String | False |
The name of the cardholder. |
CustomerId | String | False |
The ID of a customer created using the Customers API to be associated with the card. |
MerchantId | String | True |
The ID of the merchant associated with the card. |
Enabled | Boolean | True |
Indicates whether or not a card can be used for payments. |
ExpMonth | Integer | False |
The expiration month of the associated card as an integer between 1 and 12. |
ExpYear | Integer | False |
The four-digit year of the card's expiration date. |
Fingerprint | String | True |
The unique string fingerprint for the card. The fingerprint is based on the credit card number and is unique to the merchant. If a card is used at multiple locations for the same merchant, it will have the same fingerprint in each case. |
Last4 | String | True |
The last 4 digits of the card number. |
PrepaidType | String | True |
Indicates whether the Card is prepaid or not. |
ReferenceId | String | False |
An optional user-defined reference ID that associates this card with another entity in an external system. |
Version | Integer | False |
Current version number of the card. |
IdempotencyKey | String | False |
A unique string that identifies this CreateCard request. |
SourceId | String | False |
The ID of the source which represents the card information to be stored. This can be a card nonce or a payment id. |
VerificationToken | String | False |
An identifying token generated by Payments.verifyBuyer(). |
Query the available catalog categories.
Retrieve all catalog categories:
SELECT * FROM CatalogCategories
To create an item, you will need to specify the Name column.
INSERT INTO CatalogCategories (Name) VALUES ('Cat Created 2')
Modify the details of an existing CatalogCategories by providing the Id of the Categories:
UPDATE CatalogCategories SET Name = 'Cat Updated' WHERE ID = '1234'
Delete a category object by providing the Id of the Categories:
DELETE FROM CatalogCategories WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The category's ID. |
Name | String | False |
The category's name. |
UpdatedAt | Datetime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available catalog discounts.
Retrieve all catalog discounts:
SELECT * FROM CatalogDiscounts
To create an item, you will need to specify the DiscountType, Name, Amount and Currency columns.
INSERT INTO CatalogDiscounts (PINRequired, DiscountType, Name, Amount, Currency) VALUES (false, 'FIXED_PERCENTAGE', 'Special_Discount1', '200000', 'USD')
To Update an item, you will need to specify the Id column.
UPDATE CatalogDiscounts SET amount = 1234, currency = 'USD' WHERE Id = '1234'
Delete a discount object by providing the Id of the discount object:
DELETE FROM CatalogDiscounts WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The discount's ID. |
Name | String | False |
The discount's name. |
UpdatedAt | Datetime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
DiscountType | String | False |
Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale. |
Percentage | String | False |
The percentage of the discount as a string representation of a decimal number, using a . as the decimal separator and without a % sign. A value of 7.5 corresponds to 7.5%. Specify a percentage of 0 if DiscountType is VARIABLE_PERCENTAGE. |
Amount | Integer | False |
The discount's amount. |
Currency | String | False |
The discount's money currency. |
PinRequired | Boolean | False |
Indicates whether a mobile staff member needs to enter their PIN to apply the discount to a payment in the Square Point of Sale app. |
LabelColor | String | False |
The color of the discount's display label in the Square Point of Sale app. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available catalog images.
Retrieve all catalog images:
SELECT * FROM CatalogImages
To create an item, you will need to specify the Name column.
INSERT INTO CatalogImages (Name) VALUES ('Cat Created 2')
Modify the details of an existing catalog by providing the Id of the Images:
UPDATE CatalogImages SET Name = 'Cat Updated' WHERE ID = '1234'
Delete a category object by providing the Id of the Images:
DELETE FROM CatalogImages WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The image file ID. |
Name | String | False |
The internal name of this image. |
UpdatedAt | Datetime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
URL | String | False |
The URL of this image. |
Caption | String | False |
A caption that describes what is shown in the image. Displayed in the Square Online Store. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available items.
Retrieve all catalog items:
SELECT * FROM CatalogItems
To create an item, you will need to specify the Name column. All the fields that are not read-only can be specified.
INSERT INTO CatalogItems (Name) VALUES ('MyItem7')
Creating an item, by specifying aggregate columns.
INSERT INTO CatalogItems (Name, Description, IsDeleted, LabelColor, Abbreviation, AvailableOnline, AvailableForPickup, AvailableElectronically, CategoryId, TaxIds, ModifierListInfo, ProductType, SkipModifierScreen, PresentAtAllLocations, PresentAtLocationIds, AbsentAtLocationIds) VALUES ('MyItem7', 'My favorite item', false, '4ab200', 'Abbreviation', true, true, true, 'KJTFGM3N2S6ATTQFUWBO4GRF', '[ "OM6KNVLNASNSVHQ3GG4CJI3E", "4XNDTMJBDGCRFOJISE3GV3TZ", "THYCNM5QNAX2ZSYQITQ2YFJQ" ]', '[ { "modifier_list_id": "MCBLV4WVUUZ6K3MFI33N3MJB" }, { "modifier_list_id": "WHRXTOEYZZI4V6JHTA4PPPTX" } ]', 'APPOINTMENTS_SERVICE', true, true, '[ "94BYHNBR6W57E", "92BYHNBR2W73E" ]', '[ "92BYHNBR6W73E" ]')
Modify the details of an existing catalog by providing the Id of the Items object:
UPDATE CatalogItems SET Description = 'TestDesc1', Name = 'TestName1', Abbreviation = 'TestAbbreviation1', AvailableForPickup = true WHERE ID = 'SSURXB52UP6QNMHQ6XD3QY4I'
Delete a item object by providing the Id of the customer:
DELETE FROM CatalogItems WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The item's ID. |
Name | String | False |
The item's name. |
UpdatedAt | Datetime | True |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
Description | String | False |
The item's description. |
Abbreviation | String | False |
The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. |
LabelColor | String | False |
The color of the item's display label in the Square Point of Sale app. |
AvailableOnline | Boolean | False |
If true, the item can be added to shipping orders from the merchant's online store. |
AvailableForPickup | Boolean | False |
If true, the item can be added to pickup orders from the merchant's online store. |
AvailableElectronically | Boolean | False |
If true, the item can be added to electronically fulfilled orders from the merchant's online store. |
CategoryId | String | False |
The ID of the item's category, if any. |
TaxIds | String | False |
A set of IDs indicating the CatalogTaxes that are enabled for this item. |
ModifierListInfo | String | False |
Info about the modifier lists that apply to this item. |
ProductType | String | False |
The product type of the item. May not be changed once an item has been created. |
SkipModifierScreen | Boolean | False |
If true, the Square Point of Sale app will immediately add the item to the cart with the pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's details. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
ImageId | String | False |
The Id of the Image |
Variations | String | False |
It represents a product for sale in the Catalog object model. While updating, provide the whole Variations aggregate object otherwise it will override with the new value. |
Query the available item variations.
Retrieve all catalog item variations:
SELECT * FROM CatalogItemVariations
To create an item variation, you will need to specify the ItemId, PricingType, PriceMoneyAmount and PriceMoneyCurrency column, or ItemId and PricingType if PricingType is set to VARIABLE_PRICING.
All the fields that are not read-only can be specified.
INSERT INTO CatalogItemVariations (ItemId, PricingType, PriceMoneyAmount, PriceMoneyCurrency) VALUES ('2I2UELJL4543VQJF4D4EU3EJO', 'FIXED_PRICING', 1, 'USD')
Creating an item variation, by specifying aggregate columns.
INSERT INTO CatalogItemVariations (ItemId, Name, PricingType, PriceMoneyAmount, PriceMoneyCurrency, SKU, Upc, Ordinal, LocationOverrides, TrackInventory, InventoryAlertType, InventoryAlertThreshold, UserData, ServiceDuration, PresentAtAllLocations, AbsentAtLocationIds) VALUES ('YC77SWXPJLTUFUHCCYSGYMYD', 'MyItemVariations14', 'FIXED_PRICING', 1, 'USD', 'testSKU', 'testUPC', '2', '[ { "inventory_alert_threshold": 1, "location_id": "92BYHNBR6W77E", } ]', true, 'LOW_QUANTITY', 3, 'test', 3, false, '[ "92BYHNBR6W77E" ]')
Create an Item variation using TEMP Table.
INSERT INTO catalogitemvariations (name, PricingType, itemid, pricemoneyamount, pricemoneycurrency) VALUES ('hello', 'FIXED_PRICING', 'GZSJP2V2SE4KS2ZU7AJCLX5P', 19900, USD
INSERT INTO catalogitemvariations (name, PricingType, itemid, pricemoneyamount, pricemoneycurrency) VALUES ('test55', 'FIXED_PRICING', 'RSQPFRKIZZFWO3IV3UX3M5LM', 20001, USD
INSERT INTO CatalogItems (Name, Description, ModifierListInfo) VALUES ('Jeep Rentals NEW', 'Our Daily Jeep Rates', 'CatalogItemVariations#TEMP'
To Update an item, you will need to specify the Id column.
UPDATE CatalogItemVariations SET name = 'TestName1', PricingType = 'FIXED_PRICING', PriceMoneyAmount = 1010, PriceMoneyCurrency = 'USD', ItemId = 'OLCXWRVE7JD22TCS6NIRST6G', UserData = 'SEASONAL = TRUE' WHERE id = 'WNT7535N7AEJHJBMLRGGZXIK'
Delete a discount object by providing the Id of the discount object:
DELETE FROM CatalogItemVariations WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The item variation's ID. |
ItemId [KEY] | String | False |
The ID of the CatalogItem associated with this item variation. |
Name | String | False |
The item variation's name. |
UpdatedAt | Datetime | True |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
Sku | String | False |
The item variation's SKU. |
Upc | String | False |
The item variation's UPC. |
Ordinal | Integer | False |
The order in which this item variation should be displayed. |
PricingType | String | False |
Indicates whether the item variation's price is fixed or determined at the time of sale. |
PriceMoneyAmount | Integer | False |
The item variation's price amount, if fixed pricing is used. |
PriceMoneyCurrency | String | False |
The item variation's price currency, if fixed pricing is used. |
LocationOverrides | String | False |
Per-location price and inventory overrides. |
TrackInventory | Boolean | False |
If true, inventory tracking is active for the variation. |
InventoryAlertType | String | False |
Indicates whether the item variation displays an alert when its inventory quantity is less than or equal to its InventoryAlertThreshold. |
InventoryAlertThreshold | Integer | False |
If the inventory quantity for the variation is less than or equal to this value and InventoryAlertType is LOW_QUANTITY, the variation displays an alert in the merchant dashboard. |
UserData | String | False |
Arbitrary user metadata to associate with the item variation. |
ServiceDuration | Integer | False |
If the CatalogItem that owns this item variation is of type APPOINTMENTS_SERVICE, then this is the duration of the service in milliseconds. |
CatalogMeasurementUnitId | String | True |
Represents the unit used to measure a CatalogItemVariation and specifies the precision for decimal quantities. |
MeasurementUnitId | String | False |
ID of the 'CatalogMeasurementUnit' that is used to measure the quantity sold of this item variation. If left unset, the item will be sold in whole quantities. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Type | String | False |
The item variation's type. |
Query the available catalog modifier lists.
Retrieve all catalog modifier lists:
SELECT * FROM CatalogModifierLists
To create an item, you will need to specify the Name column and modifier object.
INSERT INTO CatalogModifierLists (Name, selectiontype, Modifiers) VALUES ('Type', 'MULTIPLE', '[\n" + "\t{\n" + "\t \"id\" : \"DSVHFBTUXMNTKUFSXMODS7HO\",\n" + " \"type\": \"MODIFIER\",\n" + " \"version\": 1489411961853,\n" + " \"modifier_data\":{\n" + "\t \"name\" : \"4 floor\",\n" + "\t \"on_by_default\": false,\n" + " \"price_money\": {\n" + " \"currency\": \"USD\",\n" + " \"amount\": 23900\n" + " }\n" + " }\n" + " }]'
Create a modifierlist object using TEMP table.
INSERT INTO CatalogModifiers#TEMP (Id, Type, Version, Name, PriceMoneyCurrency, PriceMoneyAmount) VALUES ('Y2R6VS3ZCF4GCLO2IJBJWMYR', 'MODIFIER', 1591591604813, '4 door', 'USD', 23900)
INSERT INTO CatalogModifierLists (Name, SelectionType, Modifiers) VALUES ('Type Updated', 'MULTIPLE', 'CatalogModifiers#TEMP'
To Update an item, you will need to specify the Id column.
UPDATE CatalogModifierLists SET Name = 'list1' WHERE Id = '1234'
Delete a modifierlist object by providing the Id of the modifierlist:
DELETE FROM CatalogModifierLists WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The CatalogModifierList's ID. |
Name | String | False |
The CatalogModifierList's name. |
UpdatedAt | Datetime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
Modifiers | String | False |
The options included in the CatalogModifierList. Each CatalogObject must have type MODIFIER and contain CatalogModifier data. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
SelectionType | String | False |
Indicates whether multiple options from the modifier list can be applied to a single CatalogItem.. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Query the available catalog modifiers.
Retrieve all catalog modifiers:
SELECT * FROM CatalogModifiers
To create an item, you will need to specify the Name column.
INSERT INTO CatalogModifiers (Name) VALUES ('Cat Created 2')
Modify the details of an existing CatalogModifiers by providing the Id of the Modifier:
UPDATE CatalogModifiers SET Name = 'Cat Updated' WHERE ID = '1234'
Delete a category object by providing the Id of the Categories:
DELETE FROM CatalogModifiers WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The modifier's ID. |
Name | String | False |
The modifier's name. |
UpdatedAt | Datetime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
PriceMoneyAmount | Integer | False |
The modifier's price amount. |
PriceMoneyCurrency | String | False |
The modifier's price currency. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
SELECT ステートメントのWHERE 句では、疑似カラムフィールドを使用して、データソースから返されるタプルを詳細に制御することができます。
Name | Type | Description |
Type | String |
The catalog object type to be modified. |
Query the available catalog taxes.
Retrieve all catalog taxes:
SELECT * FROM CatalogTaxes
To create an item, you will need to specify the Name column.
INSERT INTO CatalogTaxes (Name) VALUES ('Cat Created 2')
Modify the details of an existing CatalogTaxes by providing the Id of the tax:
UPDATE CatalogTaxes SET Name = 'Cat Updated' WHERE ID = '1234'
Delete a category object by providing the Id of the Categories:
DELETE FROM CatalogTaxes WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The Id of the tax. |
Name | String | False |
The tax's name. |
UpdatedAt | Datetime | False |
Last modification timestamp. |
IsDeleted | Boolean | False |
If true, the object has been deleted from the database. When deleted, the UpdatedAt field will equal the deletion time. |
CalculationPhase | String | False |
Whether the tax is calculated based on a payment's subtotal or total. |
InclusionType | String | False |
Whether the tax is ADDITIVE or INCLUSIVE. |
Percentage | String | False |
The percentage of the discount as a string representation of a decimal number, using a . as the decimal separator and without a % sign. A value of 7.5 corresponds to 7.5%. |
AppliesToCustomAmounts | Boolean | False |
If true, the fee applies to custom amounts entered into the Square Point of Sale app that are not associated with a particular CatalogItem. |
Enabled | Boolean | False |
If true, the tax will be shown as enabled in the Square Point of Sale app. |
PresentAtAllLocations | Boolean | False |
If true, this object is present at all locations (including future locations), except where specified in the AbsentAtLocationIds field. If false, this object is not present at any locations (including future locations), except where specified in the PresentAtLocationIds field. If not specified, defaults to true. |
PresentAtLocationIds | String | False |
A list of locations where the object is present, even if PresentAtAllLocations is false. |
AbsentAtLocationIds | String | False |
A list of locations where the object is not present, even if PresentAtAllLocations is true. |
Version | Int64 | False |
The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Create, update, delete, and query the available CustomerCards in Square.
The Cloud uses the Square API to process search criteria that refer to the CustomerId column, while other filters are processed client side within the Cloud.
Select all CustomerCards from all customers:
SELECT * FROM CustomerCards
Select all CustomerCards from a specific customer:
SELECT * FROM CustomerCards WHERE CustomerId = 'CBASEPlKoFeu4nWm0MX_oHdklAIgAQ'
To create a customer card, you will need to specify CustomerId and CardNonce.
INSERT INTO CustomerCards (CardNonce, CustomerId, BillingAddressLine1, BillingAddressLine2, BillingAddressLocality, BillingAddressPostalCode, BillingAddressCountry, CardholderName) VALUES ('fake-card-nonce-ok', 'CBASEPlKoFeu4nWm0MX_oHdklAIgAQ', '500 Electric Ave', 'Suite 600', 'New York', '94103', 'US', 'CardholderName')
A customer card can be removed by providing the Id and CustomerId.
DELETE FROM CustomerCards WHERE Id = 'eKoFeu4nWm0MX_oed' AND CustomerId = 'CBASEPlKoFeu4nWm0MX_oHdklAIgAQ'
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The card's unique ID, if any. |
CustomerId [KEY] | String | False |
The customer's unique ID. |
CardBrand | String | True |
The card's brand (such as VISA). |
Last4Digits | String | True |
The last 4 digits of the card's number. |
ExpireMonth | Integer | True |
The month of the card's expiration date. This value is always between 1 and 12, inclusive. |
ExpireYear | Integer | True |
The four-digit year of the card's expiration date. |
CardholderName | String | False |
The cardholder name. This value is present only if this object represents a customer's card on file. |
PhoneNumber | String | True |
The customer's phone number. |
Fingerprint | String | True |
The unique string fingerprint for the card. The fingerprint is based on the credit card number and is unique to the merchant. If a card is used at multiple locations for the same merchant, it will have the same fingerprint in each case. |
CardNonce | String | False |
A card nonce representing the credit card to link to the customer. |
BillingAddressLine1 | String | False |
The first line of the address. |
BillingAddressLine2 | String | False |
The second line of the address. |
BillingAddressLine3 | String | False |
The third line of the address. |
BillingAddressLocality | String | False |
The city or town of the address. |
BillingAddressSubLocality | String | False |
A civil region within the address's locality. |
BillingAddressSubLocality2 | String | False |
A civil region within the address's sublocality. |
BillingAddressSubLocality3 | String | False |
A civil region within the address's sublocality_2. |
BillingAddressAdministrativeDistrictLevel1 | String | False |
A civil entity within the address's country. In the US, this is the state. |
BillingAddressAdministrativeDistrictLevel2 | String | False |
A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
BillingAddressAdministrativeDistrictLevel3 | String | False |
A civil entity within the address's administrative_district_level_2. |
BillingAddressPostalCode | String | False |
The address's postal code. |
BillingAddressCountry | String | False |
The address's country, in ISO 3166-1-alpha-2 format. |
BillingAddressFirstName | String | False |
Optional first name when it's representing recipient. |
BillingAddressLastName | String | False |
Optional last name when it's representing recipient. |
BillingAddressOrganization | String | False |
Optional organization name when it's representing recipient. |
Create, update, delete, and query the available customers in Square.
The Cloud uses the Square API to process search criteria that refer to the Id column, while other filters are processed client side within the Cloud.
Retrieve all customers:
SELECT * FROM Customers
Retrieve only one customer:
SELECT * FROM Customers WHERE Id = '0SY145EEWD0YXCW489VV386KH8'
To create a customer, you will need to specify at least one of the following values: GivenName, FamilyName, CompanyName, EmailAddress, and PhoneNumber.
INSERT INTO Customers (GivenName, FamilyName, Email, PhoneNumber, AddressLine1, AddressLine2, AddressLocality, AddressAdministrativeDistrictLevel1, AddressPostalCode, AddressCountry) VALUES ('John', 'Doe', '[email protected]', '1-212-555-4240', '500 Electric Ave', 'Suite 600', 'New York', 'NY', '10003', 'US')
Modify the details of an existing customer by providing the Id of the customer:
UPDATE Customers SET GivenName = 'Amelia', FamilyName = 'Earhart' WHERE Id = '32123'
Delete a customer from a business, along with any linked cards on file, by providing the Id of the customer:
DELETE FROM Customers WHERE Id = '32123'
Name | Type | ReadOnly | Description |
Id [KEY] | String | True |
The Id of the customer. |
GivenName | String | False |
The customer's given (i.e., first) name. |
FamilyName | String | False |
The customer's family (i.e., last) name. |
Nickname | String | False |
The customer's nickname. |
String | False |
The customer's email address. | |
CompanyName | String | False |
The name of the customer's company. |
PhoneNumber | String | False |
The customer's phone number. |
AddressLine1 | String | False |
The first line of the address. |
AddressLine2 | String | False |
The second line of the address. |
AddressLine3 | String | False |
The third line of the address. |
AddressLocality | String | False |
The city or town of the address. |
AddressSubLocality | String | False |
A civil region within the address's locality. |
AddressSubLocality2 | String | False |
A civil region within the address's sublocality. |
AddressSubLocality3 | String | False |
A civil region within the address's sublocality_2. |
AddressAdministrativeDistrictLevel1 | String | False |
A civil entity within the address's country. In the US, this is the state. |
AddressAdministrativeDistrictLevel2 | String | False |
A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
AddressAdministrativeDistrictLevel3 | String | False |
A civil entity within the address's administrative_district_level_2. |
AddressPostalCode | String | False |
The address's postal code. |
AddressCountry | String | False |
The address's country, in ISO 3166-1-alpha-2 format. |
AddressFirstName | String | False |
Optional first name when it's representing recipient. |
AddressLastName | String | False |
Optional last name when it's representing recipient. |
AddressOrganization | String | False |
Optional organization name when it's representing recipient. |
Birthday | String | False |
The birthday associated with the customer profile, in RFC 3339 format. Year is optional, timezone and times are not allowed |
CreatedAt | Datetime | True |
The time when the customer was created. |
UpdatedAt | Datetime | True |
The time when the customer was last updated. |
ReferenceId | String | False |
A second ID you can set to associate the customer with an entity in another system. |
Note | String | False |
A note to associate with the customer. |
CardsAggregate | String | True |
The non-confidential details of the customer's cards on file. |
Preferences | String | True |
The customer's preferences. |
Segments | String | True |
The IDs of segments the customer belongs to. |
Query historical physical counts and adjustments on inventory items.
The Cloud uses the Square API to process search criteria that refer to the Type, CatalogObjectId, State and LocationId column, while other filters are processed client side within the Cloud.
Select all the inventory changes:
SELECT * FROM InventoryChanges
Select all the inventory changes from a specific location ID:
SELECT * FROM InventoryChanges WHERE LocationId = 'Sandbox_Location_Id'
Select all the inventory changes with a specific type:
SELECT * FROM InventoryChanges WHERE Type = 'ADJUSTMENT'
Select all the inventory changes in a specific state:
SELECT * FROM InventoryChanges WHERE State = 'IN_STOCK'
Select all the inventory changes for a specific catalog object:
SELECT * FROM InventoryChanges WHERE CatalogObjectId = '5QJP4XMEN5TQ4W4UY7YL'
To create an inventory change, you will need to specify the Type, CatalogObjectId, Quantity column.
Insert an inventory change of type 'PHYSICAL_COUNT' :
INSERT INTO InventoryChanges (Type, CatalogObjectId, State, Quantity) VALUES ('PHYSICAL_COUNT', '5QJP4XMEN5TQ4W4UY7YL', 'IN_STOCK', 16)
Insert an inventory change of type 'ADJUSTMENT' :
INSERT INTO InventoryChanges (Type, CatalogObjectId, FromState, ToState, Quantity) VALUES ('ADJUSTMENT', '5QJP4XMEN5TQ4W4UY7YL', 'IN_STOCK', 'SOLD', 5)
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
A unique ID generated by Square for the Inventory change. |
ReferenceId | String | False |
An optional ID provided by the application to tie the Inventory change to an external system. |
Type | String | False |
Indicates how the inventory change was applied. 使用できる値は次のとおりです。PHYSICAL_COUNT, ADJUSTMENT |
CatalogObjectId | String | False |
The Square generated ID of the CatalogObject being tracked. |
CatalogObjectType | String | False |
The CatalogObjectType of the CatalogObject being tracked. Tracking is only supported for the ITEM_VARIATION type. |
State | String | False |
The current InventoryState for the related quantity of items. |
LocationId | String | False |
The Square ID of the Location where the related quantity of items are being tracked. |
Quantity | String | False |
The number of items affected by the physical count as a decimal string. |
EmployeeId | String | False |
The Square ID of the Employee responsible for the physical count. |
OccurredAt | Datetime | False |
A client-generated timestamp in RFC 3339 format that indicates when the physical count took place. For write actions, the occurred_at timestamp cannot be older than 24 hours or in the future relative to the time of the request. |
CreatedAt | Datetime | False |
A read-only timestamp in RFC 3339 format that indicates when Square received the physical count. |
FromState | String | False |
The InventoryState of the related quantity of items before the adjustment. |
ToState | String | False |
The InventoryState of the related quantity of items before the adjustment. |
TotalPriceMoneyAmount | Integer | False |
The amount of the total price paid for goods associated with the adjustment. Present if and only if to_state is SOLD. Always non-negative. |
TotalPriceMoneyCurrency | String | False |
The currency of the total price paid for goods associated with the adjustment. Present if and only if to_state is SOLD. Always non-negative. |
TransactionId | String | False |
The read-only Square ID of the [Transaction][#type-transaction] that caused the adjustment. Only relevant for payment-related state transitions. |
RefundId | String | False |
The read-only Square ID of the Transaction that caused the adjustment. Only relevant for payment-related state transitions. |
PurchaseOrderId | String | False |
The read-only Square ID of the Refund that caused the adjustment. Only relevant for refund-related state transitions. |
GoodsReceiptId | String | False |
The read-only Square ID of the Square goods receipt that caused the adjustment. Only relevant for state transitions from the Square for Retail app. |
FromLocationId | String | False |
The Square ID of the Location where the related quantity of items were tracked before the transfer. |
ToLocationId | String | False |
The Square ID of the Location where the related quantity of items were tracked before the transfer. |
Create and query the details for all Refunds initiated by a merchant or any of the mobile staff of the merchant during a date range.
By default this table returns all refunds initiated by a merchant or any of the merchants mobile staff starting from January 1, 2013, as in the following query:
SELECT * FROM Refunds WHERE Id = '12345' SELECT * FROM Refunds WHERE Status = 'COMPLETED' AND LocationId = '92BYHNBR6W77E' SELECT * FROM Refunds WHERE LocationId = '9J0M984DXGA7W' // To get the refund for a given location
To insert a Refund, specify the PaymentId, RefundedMoneyAmount, RefundedMoneyCurrency.
INSERT INTO Refunds (PaymentId, RefundedMoneyAmount, RefundedMoneyCurrency) VALUES ('UNOE3kv2BZwqHlJ830RCt5YCuaB', 100, 'USD')
Name | Type | ReadOnly | Description |
Id [KEY] | String | False |
The unique ID for this refund, generated by Square. |
TenderId | String | False |
The Square-issued Id of the transaction tender the refund is applied to. |
RefundedMoneyAmount | Int64 | False |
The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents. |
RefundedMoneyCurrency | String | False |
The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
RefundedAppFeeMoneyAmount | Int64 | False |
The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents. |
RefundedAppFeeMoneyCurrency | String | False |
The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
CreatedAt | Datetime | False |
The time when the merchant initiated the refund for Square to process. |
LocationId | String | False |
The Id of the location. |
OrderId | String | False |
The ID of the order associated with the refund. |
PaymentId | String | False |
The ID of the payment associated with this refund. |
ProcessingFeeMoneyAmount | Int64 | False |
Processing fees and fee adjustments assessed by Square for this refund. The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents. |
ProcessingFeeMoneyCurrency | String | False |
Processing fees and fee adjustments assessed by Square for this refund. The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
ProcessingFeeEffectiveAt | Datetime | False |
Processing fees and fee adjustments assessed by Square for this refund. The timestamp of when the fee takes effect, in RFC 3339 format. |
ProcessingFeeType | String | False |
Processing fees and fee adjustments assessed by Square for this refund. The type of fee assessed or adjusted. The fee type can be INITIAL or ADJUSTMENT. |
Reason | String | False |
The merchant-specified reason for the refund. |
Status | String | False |
The refund's status 使用できる値は次のとおりです。COMPLETED, FAILED, PENDING, REJECTED |
UpdatedAt | Datetime | False |
The timestamp of when the refund was last updated, in RFC 3339 format. |
ビューは、データを示すという点でテーブルに似ていますが、ビューは読み取り専用です。
クエリは、ビューに対して通常のテーブルと同様に実行することができます。
Name | Description |
BankAccounts | Query the Bank Accounts of the merchant. |
Locations | Query Location information for a Merchant. |
Merchants | Query the available merchants in Square. |
OrderDiscounts | The list of all discounts associated with the order. |
OrderItems | The order items included in the order. Every order has at least one order item. |
Orders | Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. |
OrderTaxes | The list of all taxes associated with the order. |
Payments | Query the available card Payments in Square. Cash and other tenders payments will not be returned. |
PayoutEntries | Retrieves a list of all payout entries for a specific payout. |
Payouts | Retrieves a list of all payouts for the default location. |
Teams | Query the available list of TeamMember for a business in Square. |
Query the Bank Accounts of the merchant.
Name | Type | Description |
Id [KEY] | String | The Square-issued Id of the bank account. |
LocationId | String | The Id of the location. |
BankName | String | The name of the bank that manages the account. |
Name | String | The name associated with the bank account. |
Type | String | The type of the bank account. For example, savings or checking. |
Country | String | The ISO 3166 Alpha 2 country code where the bank account is based. |
AccountNumberSuffix | String | The last few digits of the bank account number. |
CurrencyCode | String | The code of the currency associated with the bank account. |
PrimaryBankIdentificationNumber | String | Primary identifier for the bank. |
Status | String | The current verification status of this BankAccount object. |
Creditable | Boolean | Indicates whether it is possible for Square to send money to this bank account. |
Debitable | Boolean | Indicates whether it is possible for Square to take money from this bank account. |
Version | Integer | The current version of the BankAccount. |
Query Location information for a Merchant.
Retrieve all Locations:
SELECT * FROM Locations
Name | Type | Description |
Id [KEY] | String | The location's unique ID. |
Name | String | The location's name. Location names are set by the account owner and displayed in the dashboard as the location's nickname |
Address | String | The location's physical address. |
TimeZone | String | The IANA Timezone Database identifier for the location's timezone. |
Capabilities | String | Indicates which Square features are enabled for the location. |
Status | String | The location's status. |
CreatedAt | Datetime | The time when the location was created, in RFC 3339 format. |
MerchantId | String | The identifier of the merchant that owns the location. |
Country | String | The location's country, in ISO 3166-1-alpha-2 format. |
LanguageCode | String | The language associated with the location in BCP 47 format. |
Currency | String | The currency used for all transactions at this location, specified in ISO 4217 format. |
PhoneNumber | String | The location's phone_number. |
BusinessName | String | The location's business_name which is shown to its customers. |
Type | String | The location's type, as set by the account owner in the Square dashboard. |
WebsiteUrl | String | The location's website, as set by the account owner in the Square dashboard. |
Query the available merchants in Square.
The Cloud uses the Square API to process search criteria that refer to the Id column, while other filters are processed client side within the Cloud.
Retrieve all the merchants in your Square account.
SELECT * FROM Merchants
Specify Id in the WHERE clause using the = operator:
SELECT * FROM Merchants WHERE Id = 'CD215R7H3340KCD'
Name | Type | Description |
Id [KEY] | String | The Id of the merchant. |
BusinessName | String | The merchant's business name. |
Country | String | The merchant's country. |
Currency | String | The merchant's currency. |
Status | String | The merchant's status. |
LanguageCode | String | Code of the language. |
MainLocationId | String | The ID of the main Location for this merchant. |
CreatedAt | Datetime | The time when the location was created, in RFC 3339 format. |
The list of all discounts associated with the order.
The Cloud uses the Square API to process search criteria that refer to the OrderId and LocationId, while other filters are processed client side within the Cloud.
Retrieve all the OrderDiscounts found in every order of your Square account.
SELECT * FROM OrderDiscounts
You can retrieve all order OrderDiscounts from an order by specifying the OrderId.
SELECT * FROM OrderDiscounts WHERE OrderId = 'TzratjkPk9rhOuLYvSXeznmVvIx5PVlZpg72GfPQGBxckDeeWNBN8yqnf11qTrg3W3AelXC1kB'
You can also use the IN operator to specify multiple OrderIds in the WHERE clause.
SELECT * FROM OrderDiscounts WHERE OrderId IN ('XKKB7LD30TpfNyW3e843ziklKh4vWEvweQyL5l4ESJLH3N2XXNBN8yqnf11qTrg3W3AelXC1kB', 'pxICohrEXPDtoUitiZhG1um5uhp5WI7CRMHknbuKpaj53PXfWNBN8yqnf11qTrg3W3AelXC1kB', '6j8avtXB5fIaPZ9H12beiZP7sCSiqguGhHpwmECsEaENswJnWNBN8yqnf11qTrg3W3AelXC1kB')
Name | Type | Description |
Id | String | A unique ID that identifies the discount only within this order |
LocationId | String | The Id of the location. |
AppliedAmount | Integer | The amount of discount actually applied to the line item |
AppliedCurrency | String | The type of currency, in ISO 4217 format |
AmountMoneyAmount | Integer | The total declared monetary amount of the discount amount_money is not set for percentage-based discounts |
AmountMoneyCurrency | String | The type of currency, in ISO 4217 format |
Name | String | The discount's name |
Percentage | String | The percentage of the discount |
Scope | String | Indicates the level at which the discount applies
使用できる値は次のとおりです。OTHER_DISCOUNT_SCOPE, LINE_ITEM, ORDER |
Type | String | The type of the discount
使用できる値は次のとおりです。UNKNOWN_DISCOUNT, FIXED_PERCENTAGE, FIXED_AMOUNT, VARIABLE_PERCENTAGE, VARIABLE_AMOUNT |
CatalogObjectId | String | The catalog object ID |
CatalogVersion | Integer | The version of the catalog object that this discount references |
SELECT ステートメントのWHERE 句では、疑似カラムフィールドを使用して、データソースから返されるタプルを詳細に制御することができます。
Name | Type | Description |
OrderId | String | The order's unique ID. |
The order items included in the order. Every order has at least one order item.
The Cloud uses the Square API to process search criteria that refer to the OrderId column, while other filters are processed client side within the Cloud.
Retrieve all the OrderItems found in every order of your Square account. Only orders that have been successfully charged are included in the response.
SELECT * FROM OrderItems
You can retrieve all order items from an order by specifying the OrderId.
SELECT * FROM OrderItems WHERE OrderId = 'TzratjkPk9rhOuLYvSXeznmVvIx5PVlZpg72GfPQGBxckDeeWNBN8yqnf11qTrg3W3AelXC1kB'
You can also use the IN operator to specify multiple OrderIds in the WHERE clause.
SELECT * FROM OrderItems WHERE OrderId IN ('XKKB7LD30TpfNyW3e843ziklKh4vWEvweQyL5l4ESJLH3N2XXNBN8yqnf11qTrg3W3AelXC1kB', 'pxICohrEXPDtoUitiZhG1um5uhp5WI7CRMHknbuKpaj53PXfWNBN8yqnf11qTrg3W3AelXC1kB', '6j8avtXB5fIaPZ9H12beiZP7sCSiqguGhHpwmECsEaENswJnWNBN8yqnf11qTrg3W3AelXC1kB')
Name | Type | Description |
OrderId [KEY] | String | The order's unique ID. |
OrderItemNumber [KEY] | Integer | The nth item of the order. |
LocationId | String | The Id of the location. |
Name | String | The name of the order item. |
Quantity | String | The quantity purchased, as a string representation of a number. |
Note | String | The note of the order item. |
CatalogObjectId | String | The CatalogItemVariation id applied to this order item. |
VariationName | String | The name of the variation applied to this order item. |
Taxes | String | The taxes applied to this order item. |
Discounts | String | The discounts applied to this order item. |
Modifiers | String | The CatalogModifiers applied to this order item. |
BasePriceMoneyAmount | Integer | The base price for a single unit of the order item. |
BasePriceMoneyCurrency | String | The currency of the base price for a single unit of the order item. |
GrossSalesMoneyAmount | Integer | The gross sales amount of money calculated as (item base price + modifiers price) * quantity. |
GrossSalesMoneyCurrency | String | The currency of the gross sales. |
TotalTaxMoney | Integer | The total tax amount of money to collect for the order item. |
TotalTaxMoneyCurrency | String | The currency of the total tax amount of money to collect for the order item. |
TotalDiscountMoneyAmount | Integer | The total discount amount of money to collect for the order item. |
TotalDiscountMoneyCurrency | String | The currency of the total discount amount of money to collect for the order item. |
TotalMoneyAmount | Integer | The total amount of money to collect for this order item. |
TotalMoneyCurrency | String | The currency of the total amount of money to collect for this order item. |
Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase.
The Cloud uses the Square API to process search criteria that refer to the Id column, while other filters are processed client side within the Cloud.
Retrieve all the orders in your Square account. Only orders that have been successfully charged are included in the response.
SELECT * FROM Orders
Specify multiple Ids in the WHERE clause using the IN operator:
SELECT * FROM Orders WHERE Id IN ('XKKB7LD30TpfNyW3e843ziklKh4vWEvweQyL5l4ESJLH3N2XXNBN8yqnf11qTrg3W3AelXC1kB', 'pxICohrEXPDtoUitiZhG1um5uhp5WI7CRMHknbuKpaj53PXfWNBN8yqnf11qTrg3W3AelXC1kB', '6j8avtXB5fIaPZ9H12beiZP7sCSiqguGhHpwmECsEaENswJnWNBN8yqnf11qTrg3W3AelXC1kB')
Name | Type | Description |
Id [KEY] | String | The order's unique ID |
ReferenceId | String | A client specified identifier to associate an entity in another system with this order |
LocationId | String | The Id of the location |
CreatedAt | Datetime | The time when the location was created in RFC 3339 format |
CustomerId | String | The ID of the customer associated with the order |
Discounts | String | The list of all discounts associated with the order |
LineItems | String | The line items included in the order |
NetDueAmount | Integer | The amount of money in the smallest denomination of the currency indicated by currency |
NetDueCurrency | String | The type of currency in ISO 4217 format |
NetDiscountAmount | Integer | The amount of money in the smallest denomination of the currency indicated by currency |
NetDiscountCurrency | String | The type of currency in ISO 4217 format |
NetServiceChargeAmount | Integer | The amount of money in the smallest denomination of the currency indicated by currency |
NetServiceChargeCurrency | String | The type of currency in ISO 4217 format |
NetTaxAmount | Integer | The amount of money in the smallest denomination of the currency indicated by currency |
NetTaxCurrency | String | The type of currency in ISO 4217 format |
NetTipAmount | Integer | The amount of money in the smallest denomination of the currency indicated by currency |
NetTipCurrency | String | The type of currency in ISO 4217 format |
NetTotalAmount | Integer | The amount of money in the smallest denomination of the currency indicated by currency |
NetTotalCurrency | String | The type of currency in ISO 4217 format |
PricingAutoApplyDiscounts | Boolean | The option to determine whether pricing rule-based discounts are automatically applied to an order |
SourceName | String | The name used to identify the place physical or digital that an order originates |
State | String | The current state of the order |
Taxes | String | The list of all taxes associated with the order |
Tenders | String | The tenders that were used to pay for the order |
TotalDiscountAmount | Integer | The amount of money, in the smallest denomination of the currency indicated by currency |
TotalDiscountCurrency | String | The type of currency in ISO 4217 format |
TotalAmount | Integer | The amount of money, in the smallest denomination of the currency indicated by currency |
TotalCurrency | String | The type of currency in ISO 4217 format |
ServiceChargeAmount | Integer | The amount of money, in the smallest denomination of the currency indicated by currency |
ServiceChargeCurrency | String | The type of currency in ISO 4217 format |
TaxAmount | Integer | The total amount of tax money to collect for the order |
TaxCurrency | String | The type of currency, in ISO 4217 format |
TipAmount | Integer | The total amount of tip money to collect for the order |
TipCurrency | String | The type of currency, in ISO 4217 format |
UpdatedAt | Datetime | The time when the location was updated, in RFC 3339 format |
Version | Integer | The version number, which is incremented each time an update is committed to the order |
The list of all taxes associated with the order.
The Cloud uses the Square API to process search criteria that refer to the OrderId and LocationId column, while other filters are processed client side within the Cloud.
Retrieve all the OrderTaxes found in every order of your Square account.
SELECT * FROM OrderTaxes
You can retrieve all order OrderTaxes from an order by specifying the OrderId.
SELECT * FROM OrderTaxes WHERE OrderId = 'TzratjkPk9rhOuLYvSXeznmVvIx5PVlZpg72GfPQGBxckDeeWNBN8yqnf11qTrg3W3AelXC1kB'
You can also use the IN operator to specify multiple OrderIds in the WHERE clause.
SELECT * FROM OrderTaxes WHERE OrderId IN ('XKKB7LD30TpfNyW3e843ziklKh4vWEvweQyL5l4ESJLH3N2XXNBN8yqnf11qTrg3W3AelXC1kB', 'pxICohrEXPDtoUitiZhG1um5uhp5WI7CRMHknbuKpaj53PXfWNBN8yqnf11qTrg3W3AelXC1kB', '6j8avtXB5fIaPZ9H12beiZP7sCSiqguGhHpwmECsEaENswJnWNBN8yqnf11qTrg3W3AelXC1kB')
Name | Type | Description |
Id | String | A unique ID that identifies the tax only within this order |
LocationId | String | The Id of the location. |
AppliedAmount | Integer | The amount of money applied by the tax in the order |
AppliedCurrency | String | The type of currency, in ISO 4217 format |
Name | String | The tax's name |
Percentage | String | The percentage of the tax |
Scope | String | Indicates the level at which the discount applies
使用できる値は次のとおりです。OTHER_DISCOUNT_SCOPE, LINE_ITEM, ORDER |
Type | String | Indicates the calculation method used to apply the tax
使用できる値は次のとおりです。UNKNOWN_DISCOUNT, FIXED_PERCENTAGE, FIXED_AMOUNT, VARIABLE_PERCENTAGE, VARIABLE_AMOUNT |
CatalogObjectId | String | The catalog object ID |
CatalogVersion | Integer | The version of the catalog object that this tax references. |
SELECT ステートメントのWHERE 句では、疑似カラムフィールドを使用して、データソースから返されるタプルを詳細に制御することができます。
Name | Type | Description |
OrderId | String | The order's unique ID. |
Query the available card Payments in Square. Cash and other tenders payments will not be returned.
The following queries show the filters that are processed server side, while other filters are processed client side within the Cloud.
Retrieve all Payments:
Retrieve a single payment by providing a valid Id:
SELECT * FROM Payments WHERE Id = '5xNDT7Sd6qFHsLyKlugpZIqeV'
Filter by the creation date of a Payment:
SELECT * FROM Payments WHERE CreatedAt > '2015-08-15' SELECT * FROM Payments WHERE CreatedAt < '2015-08-15'
Name | Type | Description |
Id [KEY] | String | The Id of the payment. |
MoneyAmount | Int64 | The amount of money, in the smallest denomination of the currency indicated by currency. For example, when currency is USD, amount is in cents. |
MoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
AppFeeMoneyAmount | Int64 | The amount the developer is taking as a fee for facilitating the payment on behalf of the seller. |
AppFeeMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
ApprovedMoneyAmount | Int64 | The initial amount of money approved for this payment. The amount the developer is taking as a fee for facilitating the payment on behalf of the seller. |
ApprovedMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
BankAccountOwnershipType | String | The ownership type of the bank account performing the transfer.
使用できる値は次のとおりです。INDIVIDUAL, COMPANY, UNKNOWN |
ACHDetailsAccountNumberSuffix | String | The last few digits of the bank account number. |
ACHDetailsAccountType | String | The type of the bank account performing the transfer.
使用できる値は次のとおりです。CHECKING, SAVINGS, UNKNOWN |
ACHDetailsRoutingNumber | String | The routing number for the bank account. |
BankName | String | The name of the bank associated with the bank account. |
BankAccountCountry | String | The two-letter ISO code representing the country the bank account is located in. |
BankAccountFingerprint | String | Uniquely identifies the bank account for this seller and can be used to determine if payments are from the same bank account. |
BankAccountStatementDescription | String | The statement description as sent to the bank. |
BankAccountTransferType | String | The type of the bank transfer.
使用できる値は次のとおりです。ACH, UNKNOWN |
BillingAddressLine1 | String | The first line of the address. |
BillingAddressLine2 | String | The second line of the address, if any. |
BillingAddressLine3 | String | The third line of the address, if any. |
BillingAddressAdministrativeDistrictLevel1 | String | A civil entity within the address's country. In the US, this is the state. |
BillingAddressAdministrativeDistrictLevel2 | String | A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
BillingAddressAdministrativeDistrictLevel3 | String | A civil entity within the address's administrative_district_level_2, if any. |
BillingAddressCountry | String | The address's country, in ISO 3166-1-alpha-2 format. |
BillingAddressFirstName | String | Optional first name when it's representing recipient. |
BillingAddressLastName | String | Optional last name when it's representing recipient. |
BillingAddressLocality | String | The city or town of the address. |
BillingAddressOrganization | String | Optional organization name when it's representing recipient. |
BillingAddressPostalCode | String | The address's postal code. |
BillingAddressSubLocality | String | A civil region within the address's locality, if any. |
BillingAddressSubLocality2 | String | A civil region within the address's sublocality, if any. |
BillingAddressSubLocality3 | String | A civil region within the address's sublocality_2, if any. |
BuyerEmailAddress | String | The buyer's email address. |
Capabilities | String | Actions that can be performed on this payment:EDIT_AMOUNT_UP,EDIT_AMOUNT_DOWN,EDIT_TIP_AMOUNT_UP,EDIT_TIP_AMOUNT_DOWN |
CardDetailsApplicationCryptogram | String | For EMV payments, the cryptogram generated for the payment. |
CardDetailsApplicationIdentifier | String | For EMV payments, the application ID identifies the EMV application used for the payment. |
CardDetailsApplicationName | String | For EMV payments, the human-readable name of the EMV application used for the payment. |
CardDetailsAuthResultCode | String | The status code returned by the card issuer that describes the payment's authorization status. |
CardDetailsAverageStatus | String | The status code returned from the Address Verification System (AVS) check.
使用できる値は次のとおりです。AVS_ACCEPTED, AVS_REJECTED, AVS_NOT_CHECKED |
CardId | String | Unique ID for this card. Generated by Square. |
CardBillingAddressLine1 | String | The first line of the address. |
CardBillingAddressLine2 | String | The second line of the address, if any. |
CardBillingAddressLine3 | String | The third line of the address, if any. |
CardBillingAddressAdministrativeDistrictLevel1 | String | A civil entity within the address's country. In the US, this is the state. |
CardBillingAddressAdministrativeDistrictLevel2 | String | A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
CardBillingAddressAdministrativeDistrictLevel3 | String | A civil entity within the address's administrative_district_level_2, if any. |
CardBillingAddressCountry | String | The address's country, in ISO 3166-1-alpha-2 format. |
CardBillingAddressFirstName | String | Optional first name when it's representing recipient. |
CardBillingAddressLastName | String | Optional last name when it's representing recipient. |
CardBillingAddressLocality | String | The city or town of the address. |
CardBillingAddressOrganization | String | Optional organization name when it's representing recipient. |
CardBillingAddressPostalCode | String | The address's postal code. |
CardBillingAddressSubLocality | String | A civil region within the address's locality, if any. |
CardBillingAddressSubLocality2 | String | A civil region within the address's sublocality, if any. |
CardBillingAddressSubLocality3 | String | A civil region within the address's sublocality_2, if any. |
CardBin | String | The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API returns this field. |
CardType | String | The type of the card. The Card object includes this field only in response to Payments API calls.
使用できる値は次のとおりです。UNKNOWN_CARD_TYPE, CREDIT, DEBIT |
CardholderName | String | The name of the cardholder. |
CardCustomerId | String | The ID of a customer created using the Customers API to be associated with the card. |
CardEnabled | Boolean | Indicates whether or not a card can be used for payments. |
CardExpiryMonth | Int64 | The expiration month of the associated card as an integer between 1 and 12. |
CardExpiryYear | Int64 | The four-digit year of the card's expiration date. |
CardFingerprint | String | Intended as a Square-assigned identifier, based on the card number, to identify the card across multiple locations within a single application. |
CardLast4 | String | The last 4 digits of the card number. |
CardPrepaidType | String | Indicates whether the Card is prepaid or not. The Card object includes this field only in response to Payments API calls |
CardReferenceId | String | An optional user-defined reference ID that associates this card with another entity in an external system. |
CardVersion | Int64 | Current version number of the card. Increments with each card update. |
CardTimelineAuthorizedAt | Datetime | The timestamp when the payment was authorized, in RFC 3339 format. |
CardTimelineCapturedAt | Datetime | The timestamp when the payment was captured, in RFC 3339 format. |
CardTimelineVoidedAt | Datetime | The timestamp when the payment was voided, in RFC 3339 format. |
CardCVVStatus | String | The status code returned from the Card Verification Value (CVV) check.
使用できる値は次のとおりです。CVV_ACCEPTED, CVV_REJECTED, CVV_NOT_CHECKED |
CardDeviceId | String | The Square-issued ID of the device. |
CardDeviceInstallationId | String | The Square-issued installation ID for the device. |
CardDeviceName | String | The name of the device set by the seller. |
CardEntryMethod | String | The method used to enter the card's details for the payment.
使用できる値は次のとおりです。KEYED, SWIPED, EMV, ON_FILE, CONTACTLESS |
RefundRequiresCardPresence | Boolean | Whether the card must be physically present for the payment to be refunded. If set to true, the card must be present. |
CardStatementDescription | String | The statement description sent to the card networks. |
CardStatus | String | The card payment's current state.
使用できる値は次のとおりです。AUTHORIZED, CAPTURED, VOIDED, FAILED |
CardVerificationMethod | String | For EMV payments, the method used to verify the cardholder's identity.
使用できる値は次のとおりです。PIN, SIGNATURE, PIN_AND_SIGNATURE, ON_DEVICE, NONE |
CardVerificationResults | String | For EMV payments, the results of the cardholder verification.
使用できる値は次のとおりです。SUCCESS, FAILURE, UNKNOWN |
CashBuyerSupplierMoneyAmount | Int64 | The amount of money, in the smallest denomination of the currency indicated by currency. |
CashBuyerSupplierMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
CashChangeBackMoneyAmount | Int64 | The amount of change due back to the buyer. This read-only field is calculated from the amount_money and buyer_supplied_money fields. |
CashChangeBackMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
CreatedAt | Datetime | The timestamp of when the payment was created, in RFC 3339 format. |
CustomerId | String | The Customer ID of the customer associated with the payment. |
DelayAction | String | The action to be applied to the payment when the delay_duration has elapsed. |
DelayDuration | String | The duration of time after the payment's creation when Square automatically applies the delay_action to the payment. |
DelayedUntil | Datetime | The timestamp of when the delay_action is automatically applied, in RFC 3339 format. |
EmployeeId | String | An optional ID of the employee associated with taking the payment. |
ExternalDetailsSource | String | A description of the external payment source. For example, 'Food Delivery Service'. |
ExternalDetailsType | String | The type of external payment the seller received.
使用できる値は次のとおりです。CHECK, BANK_TRANSFER, OTHER_GIFT_CARD, CRYPTO, SQUARE_CASH, SOCIAL, EXTERNAL, EMONEY, CARD, STORED_BALANCE, OTHER |
ExternalDetailsSourceFeeMoneyAmount | Int64 | The fees paid to the source. The amount_money minus this field is the net amount seller receives. |
ExternalDetailsSourceFeeMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
ExternalDetailsSourceId | String | An ID to associate the payment to its originating source. |
LocationId | String | The ID of the location associated with the payment. |
Note | String | An optional note to include when creating a payment. |
OrderId | String | The ID of the order associated with the payment. |
ProcessingFee | String | The processing fees and fee adjustments assessed by Square for this payment. |
ReceiptNumber | String | The payment's receipt number. The field is missing if a payment is canceled. |
ReceiptURL | String | The URL for the payment's receipt. The field is only populated for COMPLETED payments. |
ReferenceId | String | An optional ID that associates the payment with an entity in another system. |
RefundIds | String | A list of refund_ids identifying refunds for the payment. |
RefundedMoneyAmount | Int64 | The total amount of the payment refunded to date. |
RefundedMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
RiskEvaluationCreatedAt | Datetime | Provides information about the risk associated with the payment, as determined by Square. |
RiskEvaluationLevel | String | The risk level associated with the payment.
使用できる値は次のとおりです。PENDING, NORMAL, MODERATE, HIGH |
ShippingAddressLine1 | String | The first line of the address. |
ShippingAddressLine2 | String | The second line of the address, if any. |
ShippingAddressLine3 | String | The third line of the address, if any. |
ShippingAddressAdministrativeDistrictLevel1 | String | A civil entity within the address's country. In the US, this is the state. |
ShippingAddressAdministrativeDistrictLevel2 | String | A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
ShippingAddressAdministrativeDistrictLevel3 | String | A civil entity within the address's administrative_district_level_2, if any. |
ShippingAddressCountry | String | The address's country, in ISO 3166-1-alpha-2 format. |
ShippingAddressFirstName | String | Optional first name when it's representing recipient. |
ShippingAddressLastName | String | Optional last name when it's representing recipient. |
ShippingAddressLocality | String | The city or town of the address. |
ShippingAddressOrganization | String | Optional organization name when it's representing recipient. |
ShippingAddressPostalCode | String | The address's postal code. |
ShippingAddressSubLocality | String | A civil region within the address's locality, if any. |
ShippingAddressSubLocality2 | String | A civil region within the address's sublocality, if any. |
ShippingAddressSubLocality3 | String | A civil region within the address's sublocality_2, if any. |
SourceType | String | The source type for this payment.
使用できる値は次のとおりです。CARD, BANK_ACCOUNT, CASH, EXTERNAL |
StatementDescriptionIdentifier | String | Additional payment information that gets added to the customer's card statement as part of the statement description. |
Status | String | Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED. |
TipMoneyAmount | Int64 | The amount designated as a tip. |
TipMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
TotalMoneyAmount | Int64 | The total amount for the payment, including amount_money and tip_money. |
TotalMoneyCurrency | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
UpdatedAt | Datetime | The timestamp of when the payment was last updated, in RFC 3339 format. |
VersionToken | String | Used for optimistic concurrency. This opaque token identifies a specific version of the Payment object. |
TeamMemberId | String | An optional ID of the TeamMember associated with taking the payment. other:OutputName= |
Retrieves a list of all payout entries for a specific payout.
Name | Type | Description |
PayoutId | String | The ID of the payout to retrieve the information for. |
Id | String | The type of activity associated with this payout entry. |
FeeAmountMoneyAmount | Integer | The amount of money, in the smallest denomination of the currency indicated by currency. |
FeeAmountMoneyCurrencyCode | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
GrossAmountMoneyAmount | Integer | The amount of money, in the smallest denomination of the currency indicated by currency. |
GrossAmountMoneyCurrencyCode | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
NetAmountMoneyAmount | Integer | The amount of money, in the smallest denomination of the currency indicated by currency. |
NetAmountMoneyCurrencyCode | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
TypeChargeDetailsPaymentId | String | The ID of the payment associated with this activity. |
TypeRefundDetailsPaymentId | String | The ID of the payment associated with this activity. |
TypeRefundDetailsRefundId | String | The ID of the refund associated with this activity. |
Retrieves a list of all payouts for the default location.
Name | Type | Description |
Id [KEY] | String | A unique ID for the payout. |
Status | String | The status for the payout. |
LocationId | String | The ID of the location associated with the payout. |
CreatedAt | Datetime | The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format. |
UpdatedAt | Datetime | The timestamp of when the payout was last updated, in RFC 3339 format. |
AmountMoneyAmount | String | The amount of money, in the smallest denomination of the currency indicated by currency. |
AmountMoneyCurrencyCode | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
DestinationId | String | Square issued unique ID (also known as the instrument ID) associated with this destination. |
DestinationType | String | Type of the destination such as a bank account or debit card. |
Version | Integer | The version number, which is incremented each time an update is made to this payout record. The version number helps developers receive event notifications or feeds out of order. |
Type | String | Indicates the payout type. |
PayoutFeeAmount | String | The money amount of the payout fee. |
PayoutFeeCurrencyCode | String | The type of currency, in ISO 4217 format. For example, the currency code for US dollars is USD. |
PayoutFeeEffectiveAt | Datetime | The timestamp of when the fee takes effect, in RFC 3339 format. |
PayoutFeeType | String | The timestamp of when the fee takes effect, in RFC 3339 format. |
ArrivalDate | Date | The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination. |
EndToEndId | String | A unique ID for each Payout object that might also appear on the seller’s bank statement. |
Query the available list of TeamMember for a business in Square.
The Cloud uses the Square API to process search criteria that refer to the Id, LocationId and Status column, while other filters are processed client side within the Cloud.
Retrieve a specific team member:
SELECT * FROM Teams WHERE Id = '1ccaibDk3FapStf997Qi'
Retrieve the team member for a specific location:
SELECT * FROM Teams WHERE LocationId = ' 92BYHNBR6W77E'
Retrieve list of team members for specified locations:
SELECT * FROM Teams WHERE LocationId IN ('92BYHNBR6W77E', '92BYHNBR6W77EABCD', '92BYHNBR6W77EABCDEFGH')
Retrieve list of Active team members:
SELECT * FROM Teams WHERE Status = 'ACTIVE'
Retrieve list of Active team members in a given location:
SELECT * FROM Teams WHERE LocationId = '92BYHNBR6W77E' AND Status = 'ACTIVE'
Name | Type | Description |
Id [KEY] | String | The Id of the team member. |
FirstName | String | The first name of the team member. |
LastName | String | The last name of the team member. |
String | The email address of the team member. | |
Status | String | Whether the team member is ACTIVE or INACTIVE.
使用できる値は次のとおりです。ACTIVE, INACTIVE |
CreatedAt | Datetime | The time when the team member entity was created. |
UpdatedAt | Datetime | The time when the team member entity was last updated. |
PhoneNumber | String | The phone number of the team member. |
ReferenceId | String | A second ID used to associate the team member with an entity in another system. |
IsOwner | Boolean | Whether the team member is the owner of the Square account. |
AssignmentType | String | The current assignment type of the team member. |
LocationId | String | The locations that the team member is assigned to. |
ストアドプロシージャはファンクションライクなインターフェースで、Square の単純なSELECT/INSERT/UPDATE/DELETE 処理にとどまらずCloud の機能を拡張します。
ストアドプロシージャは、パラメータのリストを受け取り、目的の機能を実行し、プロシージャが成功したか失敗したかを示すとともにSquare から関連するレスポンスデータを返します。
Name | Description |
AddItemImage | Uploads an image file to be represented by a CatalogImage object linked to an existing CatalogObject instance. |
CaptureTransaction | Captures a transaction that was created with the Charge stored procedure with a DelayCapture value of true. |
Charge | Charges a card represented by a card nonce or a customer's card on file. |
CreateCatalogImage | Uploads an image file to be represented by a CatalogImage object linked to an existing CatalogObject instance. |
Createorder | Creates an Order that can then be referenced as OrderId in a request to the Charge endpoint. |
VoidTransaction | Cancels a transaction that was created with the Charge stored procedure with a DelayCapture value of true. |
Uploads an image file to be represented by a CatalogImage object linked to an existing CatalogObject instance.
You cannot attach an image to a new item without item variations. To create itemVariations, you must insert data in a temporary table called 'CatalogItemVariations#TEMP'.
Example: Create a catalog item variation
INSERT INTO CatalogItemVariations#TEMP (Id, Name, PriceMoneyAmount, PriceMoneyCurrency, PricingType) VALUES ('#456', 'Image Test Variation', '250000', 'USD', 'FIXED_PRICING')
After creating at least one item variation, you can execute the stored procedure.
EXECUTE AddItemImage ObjectId = '#123', ImageId = 'MMMY47ZSOGZ27RHPPDCTVSK2', ItemDataName = 'CreateItem', ItemDataProductType = 'APPOINTMENTS_SERVICE', ItemDataVariations = 'CatalogItemVariations#TEMP'
Name | Type | Required | Description |
ObjectId | String | True | Unique ID of the CatalogObject to attach to this CatalogImage. Leave this field empty to create unattached images |
AbsentAtLocationIds | String | False | A comma separated list of locations where the object is not present, even if present_at_all_locations is true. This can include locations that are deactivated. |
CatalogV1Ids | String | False | The Connect v1 IDs for this object at each location where it is present, where they differ from the object's Connect V2 ID. The field will only be present for objects that have been created or modified by legacy APIs. |
ImageId | String | True | Identifies the CatalogImage attached to this CatalogObject. |
ItemDataAbbreviation | String | False | The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. |
ItemDataAvailableElectronically | Boolean | False | If true, the item can be added to electronically fulfilled orders from the merchant's online store. |
ItemDataAvailableForPickUp | Boolean | False | If true, the item can be added to pickup orders from the merchant's online store. |
ItemDataAvailableOnline | Boolean | False | If true, the item can be added to shipping orders from the merchant's online store. |
ItemDataCategoryId | String | False | The ID of the item's category, if any. |
ItemDataDescription | String | False | The item's description. |
ItemDataLabelColor | String | False | The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code. |
ItemDataModifierListInfo | String | False | A set of CatalogItemModifierListInfo objects representing the modifier lists that apply to this item, along with the overrides and min and max limits that are specific to this item |
ItemDataName | String | False | The item's name. |
ItemDataProductType | String | False | The product type of the item. May not be changed once an item has been created. Only items of product type REGULAR or APPOINTMENTS_SERVICE may be created by this API; |
ItemDataSkipModifierScreen | Boolean | False | If false, the Square Point of Sale app will present the CatalogItem's details screen immediately, allowing the merchant to choose CatalogModifiers before adding the item to the cart. This is the default behavior. If true, the Square Point of Sale app will immediately add the item to the cart with the pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's details. |
ItemDataTaxIds | String | False | A set of IDs indicating the taxes enabled for this item. When updating an item, any taxes listed here will be added to the item. |
ItemDataVariations | String | False | A list of CatalogItemVariation objects for this item. An item must have at least one variation. |
PresentAtAllLocations | Boolean | False | If true, this object is present at all locations (including future locations), except where specified in the absent_at_location_ids field. If false, this object is not present at any locations (including future locations), except where specified in the present_at_location_ids field. If not specified, defaults to true. |
PresentAtAllLocationIds | String | False | A comma separated list of locations where the object is present, even if present_at_all_locations is false. This can include locations that are deactivated. |
ObjectVersion | Integer | False | The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Name | Type | Description |
Success | Boolean | Whether or not the image was attached to the item. |
ImageId | String | Id of the Image. |
ObjectId | String | Id of the Catalog Object to which the image is attached. |
Captures a transaction that was created with the Charge stored procedure with a DelayCapture value of true.
Name | Type | Required | Description |
TransactionId | String | True | The transaction's unique ID, issued by Square payments servers. |
Name | Type | Description |
Success | Boolean | Whether the transaction was captured. |
Charges a card represented by a card nonce or a customer's card on file.
You must include in your query either of the following:
Note: If you provide the OrderId, the AmountMoney value must exactly match the TotalMoneyAmount value of the order you have created.
EXECUTE Charge OrderId = 'XKKB7LD30TpfNyW3e843ziklKh4vWEvweQyL5l4ESJLH3N2XXNBN8yqnf11qTrg3W3AelXC1kB', AmountMoney = 55555, AmountMoneyCurrency = 'USD', CardNonce = 'fake-card-nonce-ok', ReferenceId = 'some optional reference id', Note = 'some optional note', ShippingAddressLine1 = '123 Main St', ShippingAddressLocality = 'San Francisco', ShippingAddressAdministrativeDistrictLevel1 = 'CA', ShippingAddressPostalCode = '94114', ShippingAddressCountry= 'US', BillingAddressLine1= '500 Electric Ave', BillingAddressLine2 = 'Suite 600', BillingAddressAdministrativeDistrictLevel1 = 'NY', BillingAddressLocality = 'New York', BillingAddressPostalCode = '10003', BillingAddressCountry = 'US'
Name | Type | Required | Description |
IdempotencyKey | String | False | A value you specify that uniquely identifies this transaction among transactions you've created. |
AmountMoney | String | True | The amount of money to charge. |
AmountMoneyCurrency | String | True | The value of currency must match the currency associated with the business that is charging the card. |
CardNonce | String | False | A nonce generated from the SqPaymentForm that represents the card to charge. |
CustomerCardId | String | False | The ID of the customer card on file to charge. |
DelayCapture | Boolean | False | If true, the request will only perform an Auth on the provided card. You can then later perform either a Capture or a Void. |
ReferenceId | String | False | An optional ID you can associate with the transaction for your own purposes. |
Note | String | False | An optional note to associate with the transaction. |
CustomerId | String | False | The ID of the customer to associate this transaction with. |
BuyerEmailAddress | String | False | The buyer's email address, if available. This value is optional, but this transaction is ineligible for chargeback protection if it is not provided. |
OrderId | String | False | The ID of the order to associate with this transaction. |
BillingAddressLine1 | String | False | The first line of the address. |
BillingAddressLine2 | String | False | The second line of the address. |
BillingAddressLine3 | String | False | The third line of the address. |
BillingAddressLocality | String | False | The city or town of the address. |
BillingAddressSubLocality | String | False | A civil region within the address's locality. |
BillingAddressSubLocality2 | String | False | A civil region within the address's sublocality. |
BillingAddressSubLocality3 | String | False | A civil region within the address's sublocality_2. |
BillingAddressAdministrativeDistrictLevel1 | String | False | A civil entity within the address's country. In the US, this is the state. |
BillingAddressAdministrativeDistrictLevel2 | String | False | A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
BillingAddressAdministrativeDistrictLevel3 | String | False | A civil entity within the address's administrative_district_level_2. |
BillingAddressPostalCode | String | False | The address's postal code. |
BillingAddressCountry | String | False | The address's country, in ISO 3166-1-alpha-2 format. |
BillingAddressFirstName | String | False | Optional first name when it's representing recipient. |
BillingAddressLastName | String | False | Optional last name when it's representing recipient. |
BillingAddressOrganization | String | False | Optional organization name when it's representing recipient. |
ShippingAddressLine1 | String | False | The first line of the address. |
ShippingAddressLine2 | String | False | The second line of the address. |
ShippingAddressLine3 | String | False | The third line of the address. |
ShippingAddressLocality | String | False | The city or town of the address. |
ShippingAddressSubLocality | String | False | A civil region within the address's locality. |
ShippingAddressSubLocality2 | String | False | A civil region within the address's sublocality. |
ShippingAddressSubLocality3 | String | False | A civil region within the address's sublocality_2. |
ShippingAddressAdministrativeDistrictLevel1 | String | False | A civil entity within the address's country. In the US, this is the state. |
ShippingAddressAdministrativeDistrictLevel2 | String | False | A civil entity within the address's administrative_district_level_1. In the US, this is the county. |
ShippingAddressAdministrativeDistrictLevel3 | String | False | A civil entity within the address's administrative_district_level_2. |
ShippingAddressPostalCode | String | False | The address's postal code. |
ShippingAddressCountry | String | False | The address's country, in ISO 3166-1-alpha-2 format. |
ShippingAddressFirstName | String | False | Optional first name when it's representing recipient. |
ShippingAddressLastName | String | False | Optional last name when it's representing recipient. |
ShippingAddressOrganization | String | False | Optional organization name when it's representing recipient. |
Name | Type | Description |
Success | Boolean | Whether the transaction was successful. |
TransactionId | String | The transaction's unique ID, issued by Square payments servers. |
Uploads an image file to be represented by a CatalogImage object linked to an existing CatalogObject instance.
If you want to create an image without attaching to any Catalog Object
EXECUTE CreateCatalogImage ImageFile = 'C:\\users\\image.png', ImageDataCaption = 'Test Image'
You can upload and attach image to a catalog object by specifying the objectid.
EXECUTE CreateCatalogImage ImageFile = 'C:\\users\\image.png', ImageDataCaption = 'Test Image', ObjectId = 'KGV3QARAJSYCIX4VUJZX64ZX'
In order to specify the value for ImageCatalogV1Ids, you need to create a well defined JSON structure
EXECUTE CreateCatalogImage ImageFile = 'C:\\users\\image.png', ImageDataCaption = 'Test Image', ImageCatalogV1Ids = '[{"catalog_v1_id":"KGV3QARAJSYCIX4VUJZX64ZX","location_id":"29BYHNBR6W77E"}]'
Name | Type | Required | Description |
ImageFile | String | False | An image file in JPEG, PJPEG, PNG, or GIF format. |
ObjectId | String | False | Unique ID of the CatalogObject to attach to this CatalogImage. Leave this field empty to create unattached images |
ImageAbsentAtLocationIds | String | False | A comma separated list of locations where the object is not present, even if present_at_all_locations is true. This can include locations that are deactivated. |
ImageCatalogV1Ids | String | False | The Connect v1 IDs for this object at each location where it is present, where they differ from the object's Connect V2 ID. The field will only be present for objects that have been created or modified by legacy APIs. |
ImageDataCaption | String | True | A caption that describes what is shown in the image. |
ImageDataName | String | False | The internal name to identify this image in calls to the Square API. |
ImageDataUrl | String | False | The URL of this image, generated by Square after an image is uploaded using the CreateCatalogImage endpoint. |
PresentAtAllLocations | Boolean | False | If true, this object is present at all locations (including future locations), except where specified in the absent_at_location_ids field. If false, this object is not present at any locations (including future locations), except where specified in the present_at_location_ids field. If not specified, defaults to true. |
PresentAtAllLocationIds | String | False | A comma separated list of locations where the object is present, even if present_at_all_locations is false. This can include locations that are deactivated. |
ObjectVersion | Integer | False | The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. |
Name | Type | Description |
Success | Boolean | Whether or not the image was attached to the item. |
ImageId | String | Id of the Image. |
ImageUrl | String | The url of the uploaded image. |
Creates an Order that can then be referenced as OrderId in a request to the Charge endpoint.
You cannot create an order without order items. To create orderItems, you must insert data in a temporary table called 'OrderItem#TEMP'.
Example: Create three order items
Insert INTO OrderItem#TEMP (Name, Quantity, BasePriceMoneyAmount, BasePriceMoneyCurrency) VALUES ('New York Strip Steak', '1', 1599, 'USD') Insert INTO OrderItem#TEMP (Name, Quantity, BasePriceMoneyAmount, BasePriceMoneyCurrency) VALUES ('New York Strip Steak-Special', '1', 2599, 'USD') Insert INTO OrderItem#TEMP (quantity, CatalogObjectId, Modifiers, Discounts) VALUES ('2', 'BEMYCSMIJL46OCDV4KYIKXIB', '[\n" + " {\n" + " \"catalog_object_id\": \"CHQX7Y4KY6N5KINJKZCFURPZ\"\n" + " }\n" + " ]', '[\n" + " {\n" + " \"name\": \"Sale - $1.00 off\",\n" + " \"amount_money\": {\n" + " \"amount\": 100,\n" + " \"currency\": \"USD\"\n" + " }\n" + " }\n" + " ]')The columns available for this temporary table are the following:
The last three columns are aggregates. You need to create the JSON structure to provide the values to insert. For more information about the specific JSON structure, visit the following link: https://docs.connect.squareup.com/api/connect/v2#type-createorderrequestlineitem
After creating at least one order item, you can execute the stored procedure.
If you want to charge this order, you must set AutoCharge to 'true'.
Note: For adding more than one values to "Taxes" and "Discounts", you can use the OrderTaxes#TEMP and OrderDiscounts#TEMP tables or create the JSON structure to provide the values to insert. Please refer the columns available for OrderTaxes and OrderDiscounts from Orders View
INSERT INTO OrderTaxes#TEMP (TaxName, TaxPercentage) VALUES ('State Sales Tax', '9') INSERT INTO OrderTaxes#TEMP (TaxName, TaxPercentage) VALUES ('Central Sales Tax', '9') INSERT INTO OrderDiscounts#TEMP (DiscountName, DiscountPercentage) VALUES ('Labor Day Sale', '5') INSERT INTO OrderDiscounts#TEMP (DiscountName, DiscountPercentage) VALUES ('New Year Sale', '10') EXECUTE CreateOrder AutoCharge = true, CardNonce = 'fake-card-nonce-ok', ReferenceId = 'my-order-001', OrderLineItems = 'OrderItem#TEMP', OrderTaxes = 'OrderTaxes#TEMP', OrderDiscounts = 'OrderDiscounts#TEMP'
EXECUTE CreateOrder AutoCharge = true, CardNonce = 'fake-card-nonce-ok', ReferenceId = 'my-order-001', OrderLineItems = 'OrderItem#TEMP', OrderTaxes = '[{"OrderTaxName":"State Sales Tax","OrderTaxPercentage": 9}]', OrderDiscounts = '[{"OrderDiscountName":"Labor Day Sale","OrderDiscountPercentage":5}]'
Name | Type | Required | Description |
AutoCharge | Boolean | False | Charge the order automatically |
CardNonce | String | False | A nonce generated from the SqPaymentForm that represents the card to charge. |
CustomerCardId | String | False | The ID of the customer card on file to charge. |
CustomerId | String | False | The ID of the customer to associate this transaction with. |
IdempotencyKey | String | False | A value you specify that uniquely identifies this order among orders you've created. |
ReferenceId | String | False | An optional ID you can associate with the transaction for your own purposes. |
OrderLineItems | String | False | The aggregate for the order line items. |
OrderTaxAmountMoneyAmount | Integer | False | Only used for ad hoc taxes. The monetary amount of the tax. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxAmountMoneyCurrency | String | False | Only used for ad hoc taxes. The currency of the tax monetary amount. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxAppliedMoneyAmount | Integer | False | Only used for ad hoc taxes. The applied amount by the tax. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxAppliedMoneyCurrency | String | False | Only used for ad hoc taxes. The currency of the tax applied amount. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxCatalogObjectId | String | False | Only used for catalog taxes. The catalog object ID of an existing CatalogTax. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxName | String | False | Only used for ad hoc taxes. The tax's name. Do not provide a value for this field if you set catalogobjectid. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxPercentage | String | False | Only used for ad hoc taxes. The percentage of the tax, as a string representation of a decimal number. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxScope | String | False | Only used for ad hoc taxes. Indicates the level at which the tax applies. Possible values are OTHER_TAX_SCOPE, LINE_ITEM, ORDER. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxType | String | False | Only used for ad hoc taxes. The type of the tax. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxUID | String | False | Only used for ad hoc taxes. Unique ID that identifies the tax only within this order. This column input will not be accepted if OrderTaxes column is added. |
OrderTaxes | String | False | The aggregate for the order taxes. |
OrderDiscountAmountMoneyAmount | Integer | False | Only used for ad hoc discounts. The monetary amount of the discount. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountAmountMoneyCurrency | String | False | Only used for ad hoc discounts. The currency of the discount monetary amount. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountAppliedMoneyAmount | Integer | False | Only used for ad hoc discounts. The applied amount of the discount. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountAppliedMoneyCurrency | String | False | Only used for ad hoc discounts. The currency of the discount applied amount. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountCatalogObjectId | String | False | Only used for catalog discounts. The catalog object ID from exsiting CatalogDiscount. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountName | String | False | Only used for ad hoc discounts. The discount's name. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountPercentage | String | False | Only used for ad hoc discounts. The percentage of the discount, as a string representation of a decimal number. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountScope | String | False | Only used for ad hoc discounts. Indicates the level at which the discount applies. Possible values are OTHER_DISCOUNT_SCOPE, LINE_ITEM, ORDER. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountType | String | False | Only used for ad hoc discounts. The type of the discount. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscountUID | String | False | Only used for ad hoc discounts. Unique ID that identifies the discount only within this order. This column input will not be accepted if OrderDiscounts column is added. |
OrderDiscounts | String | False | The aggregate for the order discounts. |
Name | Type | Description |
Success | Boolean | Whether the transaction was successful. |
OrderId | String | The transaction's unique ID, issued by Square payments servers. |
Charged | Boolean | Whether the order is charged or not. |
TransactionId | String | The transaction ID created after charging the order. |
Cancels a transaction that was created with the Charge stored procedure with a DelayCapture value of true.
Name | Type | Required | Description |
TransactionId | String | True | The transaction's unique ID, issued by Square payments servers. |
Name | Type | Description |
Success | Boolean | Whether the transaction was canceled. |
このセクションで説明されているシステムテーブルをクエリして、スキーマ情報、データソース機能に関する情報、およびバッチ操作の統計にアクセスできます。
以下のテーブルは、Square のデータベースメタデータを返します。
以下のテーブルは、データソースへの接続方法およびクエリ方法についての情報を返します。
次のテーブルは、データ変更クエリのクエリ統計を返します。
利用可能なデータベースをリストします。
次のクエリは、接続文字列で決定されるすべてのデータベースを取得します。
SELECT * FROM sys_catalogs
Name | Type | Description |
CatalogName | String | データベース名。 |
利用可能なスキーマをリストします。
次のクエリは、すべての利用可能なスキーマを取得します。
SELECT * FROM sys_schemas
Name | Type | Description |
CatalogName | String | データベース名。 |
SchemaName | String | スキーマ名。 |
利用可能なテーブルをリストします。
次のクエリは、利用可能なテーブルおよびビューを取得します。
SELECT * FROM sys_tables
Name | Type | Description |
CatalogName | String | テーブルまたはビューを含むデータベース。 |
SchemaName | String | テーブルまたはビューを含むスキーマ。 |
TableName | String | テーブル名またはビュー名。 |
TableType | String | テーブルの種類(テーブルまたはビュー)。 |
Description | String | テーブルまたはビューの説明。 |
IsUpdateable | Boolean | テーブルが更新可能かどうか。 |
利用可能なテーブルおよびビューのカラムについて説明します。
次のクエリは、Payments テーブルのカラムとデータ型を返します。
SELECT ColumnName, DataTypeName FROM sys_tablecolumns WHERE TableName='Payments'
Name | Type | Description |
CatalogName | String | テーブルまたはビューを含むデータベースの名前。 |
SchemaName | String | テーブルまたはビューを含むスキーマ。 |
TableName | String | カラムを含むテーブルまたはビューの名前。 |
ColumnName | String | カラム名。 |
DataTypeName | String | データ型の名前。 |
DataType | Int32 | データ型を示す整数値。この値は、実行時に環境に基づいて決定されます。 |
Length | Int32 | カラムのストレージサイズ。 |
DisplaySize | Int32 | 指定されたカラムの通常の最大幅(文字数)。 |
NumericPrecision | Int32 | 数値データの最大桁数。文字データおよび日時データの場合は、カラムの長さ(文字数)。 |
NumericScale | Int32 | カラムのスケール(小数点以下の桁数)。 |
IsNullable | Boolean | カラムがNull を含められるかどうか。 |
Description | String | カラムの簡単な説明。 |
Ordinal | Int32 | カラムのシーケンスナンバー。 |
IsAutoIncrement | String | カラムに固定増分値が割り当てられるかどうか。 |
IsGeneratedColumn | String | 生成されたカラムであるかどうか。 |
IsHidden | Boolean | カラムが非表示かどうか。 |
IsArray | Boolean | カラムが配列かどうか。 |
IsReadOnly | Boolean | カラムが読み取り専用かどうか。 |
IsKey | Boolean | sys_tablecolumns から返されたフィールドがテーブルの主キーであるかどうか。 |
利用可能なストアドプロシージャをリストします。
次のクエリは、利用可能なストアドプロシージャを取得します。
SELECT * FROM sys_procedures
Name | Type | Description |
CatalogName | String | ストアドプロシージャを含むデータベース。 |
SchemaName | String | ストアドプロシージャを含むスキーマ。 |
ProcedureName | String | ストアドプロシージャの名前。 |
Description | String | ストアドプロシージャの説明。 |
ProcedureType | String | PROCEDURE やFUNCTION などのプロシージャのタイプ。 |
ストアドプロシージャパラメータについて説明します。
次のクエリは、RefreshOAuthAccessToken ストアドプロシージャのすべての入力パラメータについての情報を返します。
SELECT * FROM sys_procedureparameters WHERE ProcedureName='RefreshOAuthAccessToken' AND Direction=1 OR Direction=2
Name | Type | Description |
CatalogName | String | ストアドプロシージャを含むデータベースの名前。 |
SchemaName | String | ストアドプロシージャを含むスキーマの名前。 |
ProcedureName | String | パラメータを含むストアドプロシージャの名前。 |
ColumnName | String | ストアドプロシージャパラメータの名前。 |
Direction | Int32 | パラメータのタイプに対応する整数値:input (1)。input/output (2)、またはoutput(4)。input/output タイプパラメータは、入力パラメータと出力パラメータの両方になれます。 |
DataTypeName | String | データ型の名前。 |
DataType | Int32 | データ型を示す整数値。この値は、実行時に環境に基づいて決定されます。 |
Length | Int32 | 文字データの場合は、許可される文字数。数値データの場合は、許可される桁数。 |
NumericPrecision | Int32 | 数値データの場合は最大精度。文字データおよび日時データの場合は、カラムの長さ(文字数)。 |
NumericScale | Int32 | 数値データの小数点以下の桁数。 |
IsNullable | Boolean | パラメータがNull を含められるかどうか。 |
IsRequired | Boolean | プロシージャの実行にパラメータが必要かどうか。 |
IsArray | Boolean | パラメータが配列かどうか。 |
Description | String | パラメータの説明。 |
Ordinal | Int32 | パラメータのインデックス。 |
主キーおよび外部キーについて説明します。
次のクエリは、Payments テーブルの主キーを取得します。
SELECT * FROM sys_keycolumns WHERE IsKey='True' AND TableName='Payments'
Name | Type | Description |
CatalogName | String | キーを含むデータベースの名前。 |
SchemaName | String | キーを含むスキーマの名前。 |
TableName | String | キーを含むテーブルの名前。 |
ColumnName | String | キーカラムの名前 |
IsKey | Boolean | カラムがTableName フィールドで参照されるテーブル内の主キーかどうか。 |
IsForeignKey | Boolean | カラムがTableName フィールドで参照される外部キーかどうか。 |
PrimaryKeyName | String | 主キーの名前。 |
ForeignKeyName | String | 外部キーの名前。 |
ReferencedCatalogName | String | 主キーを含むデータベース。 |
ReferencedSchemaName | String | 主キーを含むスキーマ。 |
ReferencedTableName | String | 主キーを含むテーブル。 |
ReferencedColumnName | String | 主キーのカラム名。 |
外部キーについて説明します。
次のクエリは、他のテーブルを参照するすべての外部キーを取得します。
SELECT * FROM sys_foreignkeys WHERE ForeignKeyType = 'FOREIGNKEY_TYPE_IMPORT'
名前 | タイプ | 説明 |
CatalogName | String | キーを含むデータベースの名前。 |
SchemaName | String | キーを含むスキーマの名前。 |
TableName | String | キーを含むテーブルの名前。 |
ColumnName | String | キーカラムの名前 |
PrimaryKeyName | String | 主キーの名前。 |
ForeignKeyName | String | 外部キーの名前。 |
ReferencedCatalogName | String | 主キーを含むデータベース。 |
ReferencedSchemaName | String | 主キーを含むスキーマ。 |
ReferencedTableName | String | 主キーを含むテーブル。 |
ReferencedColumnName | String | 主キーのカラム名。 |
ForeignKeyType | String | 外部キーがインポート(他のテーブルを指す)キーかエクスポート(他のテーブルから参照される)キーかを指定します。 |
主キーについて説明します。
次のクエリは、すべてのテーブルとビューから主キーを取得します。
SELECT * FROM sys_primarykeys
Name | Type | Description |
CatalogName | String | キーを含むデータベースの名前。 |
SchemaName | String | キーを含むスキーマの名前。 |
TableName | String | キーを含むテーブルの名前。 |
ColumnName | String | キーカラムの名前。 |
KeySeq | String | 主キーのシーケンス番号。 |
KeyName | String | 主キーの名前。 |
利用可能なインデックスについて説明します。インデックスをフィルタリングすることで、より高速なクエリ応答時間でセレクティブクエリを記述できます。
次のクエリは、主キーでないすべてのインデックスを取得します。
SELECT * FROM sys_indexes WHERE IsPrimary='false'
Name | Type | Description |
CatalogName | String | インデックスを含むデータベースの名前。 |
SchemaName | String | インデックスを含むスキーマの名前。 |
TableName | String | インデックスを含むテーブルの名前。 |
IndexName | String | インデックス名。 |
ColumnName | String | インデックスに関連付けられたカラムの名前。 |
IsUnique | Boolean | インデックスが固有の場合はTrue。そうでない場合はFalse。 |
IsPrimary | Boolean | インデックスが主キーの場合はTrue。そうでない場合はFalse。 |
Type | Int16 | インデックスタイプに対応する整数値:statistic (0)、clustered (1)、hashed (2)、またはother (3)。 |
SortOrder | String | 並べ替え順序:A が昇順、D が降順。 |
OrdinalPosition | Int16 | インデックスのカラムのシーケンスナンバー。 |
利用可能な接続プロパティと、接続文字列に設定されている接続プロパティに関する情報を返します。
このテーブルをクエリする際は、config 接続文字列を使用する必要があります。
jdbc:cdata:square:config:
この接続文字列を使用すると、有効な接続がなくてもこのテーブルをクエリできます。
次のクエリは、接続文字列に設定されている、あるいはデフォルト値で設定されているすべての接続プロパティを取得します。
SELECT * FROM sys_connection_props WHERE Value <> ''
Name | Type | Description |
Name | String | 接続プロパティ名。 |
ShortDescription | String | 簡単な説明。 |
Type | String | 接続プロパティのデータ型。 |
Default | String | 明示的に設定されていない場合のデフォルト値。 |
Values | String | 可能な値のカンマ区切りリスト。別な値が指定されていると、検証エラーがスローされます。 |
Value | String | 設定した値またはあらかじめ設定されたデフォルト。 |
Required | Boolean | プロパティが接続に必要かどうか。 |
Category | String | 接続プロパティのカテゴリ。 |
IsSessionProperty | String | プロパティが、現在の接続に関する情報を保存するために使用されるセッションプロパティかどうか。 |
Sensitivity | String | プロパティの機密度。これは、プロパティがロギングおよび認証フォームで難読化されているかどうかを通知します。 |
PropertyName | String | キャメルケースの短縮形の接続プロパティ名。 |
Ordinal | Int32 | パラメータのインデックス。 |
CatOrdinal | Int32 | パラメータカテゴリのインデックス。 |
Hierarchy | String | このプロパティと一緒に設定する必要がある、関連のある依存プロパティを表示します。 |
Visible | Boolean | プロパティが接続UI に表示されるかどうかを通知します。 |
ETC | String | プロパティに関するその他のさまざまな情報。 |
Cloud がデータソースにオフロードできるSELECT クエリ処理について説明します。
SQL 構文の詳細については、SQL 準拠 を参照してください。
以下はSQL 機能のサンプルデータセットです。 SELECT 機能のいくつかの側面がサポートされている場合には、カンマ区切りのリストで返されます。サポートされていない場合、カラムにはNO が入ります。
名前 | 説明 | 有効な値 |
AGGREGATE_FUNCTIONS | サポートされている集計関数。 | AVG, COUNT, MAX, MIN, SUM, DISTINCT |
COUNT | COUNT 関数がサポートされているかどうか。 | YES, NO |
IDENTIFIER_QUOTE_OPEN_CHAR | 識別子をエスケープするための開始文字。 | [ |
IDENTIFIER_QUOTE_CLOSE_CHAR | 識別子をエスケープするための終了文字。 | ] |
SUPPORTED_OPERATORS | サポートされているSQL 演算子。 | =, >, <, >=, <=, <>, !=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, OR |
GROUP_BY | GROUP BY がサポートされているかどうか。サポートされている場合、どのレベルでサポートされているか。 | NO, NO_RELATION, EQUALS_SELECT, SQL_GB_COLLATE |
OJ_CAPABILITIES | サポートされている外部結合の種類。 | NO, LEFT, RIGHT, FULL, INNER, NOT_ORDERED, ALL_COMPARISON_OPS |
OUTER_JOINS | 外部結合がサポートされているかどうか。 | YES, NO |
SUBQUERIES | サブクエリがサポートされているかどうか。サポートされていれば、どのレベルでサポートされているか。 | NO, COMPARISON, EXISTS, IN, CORRELATED_SUBQUERIES, QUANTIFIED |
STRING_FUNCTIONS | サポートされている文字列関数。 | LENGTH, CHAR, LOCATE, REPLACE, SUBSTRING, RTRIM, LTRIM, RIGHT, LEFT, UCASE, SPACE, SOUNDEX, LCASE, CONCAT, ASCII, REPEAT, OCTET, BIT, POSITION, INSERT, TRIM, UPPER, REGEXP, LOWER, DIFFERENCE, CHARACTER, SUBSTR, STR, REVERSE, PLAN, UUIDTOSTR, TRANSLATE, TRAILING, TO, STUFF, STRTOUUID, STRING, SPLIT, SORTKEY, SIMILAR, REPLICATE, PATINDEX, LPAD, LEN, LEADING, KEY, INSTR, INSERTSTR, HTML, GRAPHICAL, CONVERT, COLLATION, CHARINDEX, BYTE |
NUMERIC_FUNCTIONS | サポートされている数値関数。 | ABS, ACOS, ASIN, ATAN, ATAN2, CEILING, COS, COT, EXP, FLOOR, LOG, MOD, SIGN, SIN, SQRT, TAN, PI, RAND, DEGREES, LOG10, POWER, RADIANS, ROUND, TRUNCATE |
TIMEDATE_FUNCTIONS | サポートされている日付および時刻関数。 | NOW, CURDATE, DAYOFMONTH, DAYOFWEEK, DAYOFYEAR, MONTH, QUARTER, WEEK, YEAR, CURTIME, HOUR, MINUTE, SECOND, TIMESTAMPADD, TIMESTAMPDIFF, DAYNAME, MONTHNAME, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, EXTRACT |
REPLICATION_SKIP_TABLES | レプリケーション中にスキップされたテーブルを示します。 | |
REPLICATION_TIMECHECK_COLUMNS | レプリケーション中に更新判断のカラムとして使用するかどうかを、(指定された順に)チェックするカラムのリストを含む文字列の配列。 | |
IDENTIFIER_PATTERN | 識別子としてどの文字列が有効かを示す文字列値。 | |
SUPPORT_TRANSACTION | プロバイダーが、コミットやロールバックなどのトランザクションをサポートしているかどうかを示します。 | YES, NO |
DIALECT | 使用するSQL ダイアレクトを示します。 | |
KEY_PROPERTIES | Uniform データベースを特定するプロパティを示します。 | |
SUPPORTS_MULTIPLE_SCHEMAS | プロバイダー用に複数のスキームが存在するかどうかを示します。 | YES, NO |
SUPPORTS_MULTIPLE_CATALOGS | プロバイダー用に複数のカタログが存在するかどうかを示します。 | YES, NO |
DATASYNCVERSION | このドライバーにアクセスするために必要な、CData Sync のバージョン。 | Standard, Starter, Professional, Enterprise |
DATASYNCCATEGORY | このドライバーのCData Sync カテゴリ。 | Source, Destination, Cloud Destination |
SUPPORTSENHANCEDSQL | API で提供されている以上の、追加SQL 機能がサポートされているかどうか。 | TRUE, FALSE |
SUPPORTS_BATCH_OPERATIONS | バッチ操作がサポートされているかどうか。 | YES, NO |
SQL_CAP | このドライバーでサポートされているすべてのSQL 機能。 | SELECT, INSERT, DELETE, UPDATE, TRANSACTIONS, ORDERBY, OAUTH, ASSIGNEDID, LIMIT, LIKE, BULKINSERT, COUNT, BULKDELETE, BULKUPDATE, GROUPBY, HAVING, AGGS, OFFSET, REPLICATE, COUNTDISTINCT, JOINS, DROP, CREATE, DISTINCT, INNERJOINS, SUBQUERIES, ALTER, MULTIPLESCHEMAS, GROUPBYNORELATION, OUTERJOINS, UNIONALL, UNION, UPSERT, GETDELETED, CROSSJOINS, GROUPBYCOLLATE, MULTIPLECATS, FULLOUTERJOIN, MERGE, JSONEXTRACT, BULKUPSERT, SUM, SUBQUERIESFULL, MIN, MAX, JOINSFULL, XMLEXTRACT, AVG, MULTISTATEMENTS, FOREIGNKEYS, CASE, LEFTJOINS, COMMAJOINS, WITH, LITERALS, RENAME, NESTEDTABLES, EXECUTE, BATCH, BASIC, INDEX |
PREFERRED_CACHE_OPTIONS | 使用したいcacheOptions を指定する文字列値。 | |
ENABLE_EF_ADVANCED_QUERY | ドライバーがEntity Framework の高度なクエリをサポートしているかどうかを示します。サポートしていなければ、クエリはクライアントサイドで処理されます。 | YES, NO |
PSEUDO_COLUMNS | 利用可能な疑似カラムを示す文字列の配列。 | |
MERGE_ALWAYS | 値がtrue であれば、CData Sync 内でMerge Model が強制的に実行されます。 | TRUE, FALSE |
REPLICATION_MIN_DATE_QUERY | レプリケート開始日時を返すSELECT クエリ。 | |
REPLICATION_MIN_FUNCTION | サーバーサイドでmin を実行するために使用する式名を、プロバイダーが指定できるようになります。 | |
REPLICATION_START_DATE | レプリケート開始日を、プロバイダーが指定できるようになります。 | |
REPLICATION_MAX_DATE_QUERY | レプリケート終了日時を返すSELECT クエリ。 | |
REPLICATION_MAX_FUNCTION | サーバーサイドでmax を実行するために使用する式名を、プロバイダーが指定できるようになります。 | |
IGNORE_INTERVALS_ON_INITIAL_REPLICATE | 初回のレプリケートで、レプリケートをチャンクに分割しないテーブルのリスト。 | |
CHECKCACHE_USE_PARENTID | CheckCache 構文を親キーカラムに対して実行するかどうかを示します。 | TRUE, FALSE |
CREATE_SCHEMA_PROCEDURES | スキーマファイルの生成に使用できる、ストアドプロシージャを示します。 |
次のクエリは、WHERE 句で使用できる演算子を取得します。
SELECT * FROM sys_sqlinfo WHERE Name = 'SUPPORTED_OPERATORS'
WHERE 句では、個々のテーブルの制限や要件が異なる場合がありますので注意してください。詳しくは、データモデル セクションを参照してください。
Name | Type | Description |
NAME | String | SQL 構文のコンポーネント、またはサーバー上で処理できる機能。 |
VALUE | String | サポートされるSQL またはSQL 構文の詳細。 |
試行された変更に関する情報を返します。
次のクエリは、バッチ処理で変更された行のId を取得します。
SELECT * FROM sys_identity
Name | Type | Description |
Id | String | データ変更処理から返された、データベース生成Id。 |
Batch | String | バッチの識別子。1 は単一処理。 |
Operation | String | バッチ内の処理の結果:INSERTED、UPDATED、またはDELETED。 |
Message | String | SUCCESS、またはバッチ内の更新が失敗した場合のエラーメッセージ。 |
プロパティ | 説明 |
LocationId | The Id of a business location that will be set as default. |
UseSandbox | A boolean indicating whether you are using a Sandbox account. The provider makes requests to the production environment by default. |
プロパティ | 説明 |
SSLServerCert | TLS/SSL を使用して接続するときに、サーバーが受け入れ可能な証明書。 |
プロパティ | 説明 |
Verbosity | ログファイルの記述をどの程度の詳細さで記載するかを決定するverbosity レベル。 |
プロパティ | 説明 |
BrowsableSchemas | このプロパティは、使用可能なスキーマのサブセットにレポートされるスキーマを制限します。例えば、BrowsableSchemas=SchemaA,SchemaB,SchemaC です。 |
Schema | Specify the Square server version to connect with. |
プロパティ | 説明 |
MaxRows | クエリで集計またはGROUP BY を使用しない場合に返される行数を制限します。これはLIMIT 句よりも優先されます。 |
PseudoColumns | このプロパティは、テーブルのカラムとして疑似カラムが含まれているかどうかを示します。 |
Timeout | タイムアウトエラーがスローされ、処理をキャンセルするまでの秒数。 |
このセクションでは、本プロバイダーの接続文字列で設定可能なAuthentication プロパティの全リストを提供します。
プロパティ | 説明 |
LocationId | The Id of a business location that will be set as default. |
UseSandbox | A boolean indicating whether you are using a Sandbox account. The provider makes requests to the production environment by default. |
The Id of a business location that will be set as default.
string
""
The Id of one of your business locations that will be set as default. This can also be set in the search criteria of the query. A value set in the query overrides the value set in this connection property. You can retrieve the Ids for your Locations by querying the Locations table.
A boolean indicating whether you are using a Sandbox account. The provider makes requests to the production environment by default.
bool
false
If you are using a production account, this property can be left blank.
このセクションでは、本プロバイダーの接続文字列で設定可能なSSL プロパティの全リストを提供します。
プロパティ | 説明 |
SSLServerCert | TLS/SSL を使用して接続するときに、サーバーが受け入れ可能な証明書。 |
TLS/SSL を使用して接続するときに、サーバーが受け入れ可能な証明書。
string
""
TLS/SSL 接続を使用する場合は、このプロパティを使用して、サーバーが受け入れるTLS/SSL 証明書を指定できます。コンピュータによって信頼されていない他の証明書はすべて拒否されます。
このプロパティは、次のフォームを取ります:
説明 | 例 |
フルPEM 証明書(例では省略されています) | -----BEGIN CERTIFICATE----- MIIChTCCAe4CAQAwDQYJKoZIhv......Qw== -----END CERTIFICATE----- |
証明書を保有するローカルファイルへのパス。 | C:\cert.cer |
公開鍵(例では省略されています) | -----BEGIN RSA PUBLIC KEY----- MIGfMA0GCSq......AQAB -----END RSA PUBLIC KEY----- |
MD5 Thumbprint (hex 値はスペースおよびコロン区切り) | ecadbdda5a1529c58a1e9e09828d70e4 |
SHA1 Thumbprint (hex 値はスペースおよびコロン区切り) | 34a929226ae0819f2ec14b4a3d904f801cbb150d |
これを指定しない場合は、マシンが信用するすべての証明書が受け入れられます。
すべての証明書の受け入れを示すには、'*'を使用します。セキュリティ上の理由から、これはお勧めできません。
このセクションでは、本プロバイダーの接続文字列で設定可能なLogging プロパティの全リストを提供します。
プロパティ | 説明 |
Verbosity | ログファイルの記述をどの程度の詳細さで記載するかを決定するverbosity レベル。 |
このセクションでは、本プロバイダーの接続文字列で設定可能なSchema プロパティの全リストを提供します。
プロパティ | 説明 |
BrowsableSchemas | このプロパティは、使用可能なスキーマのサブセットにレポートされるスキーマを制限します。例えば、BrowsableSchemas=SchemaA,SchemaB,SchemaC です。 |
Schema | Specify the Square server version to connect with. |
このプロパティは、使用可能なスキーマのサブセットにレポートされるスキーマを制限します。例えば、BrowsableSchemas=SchemaA,SchemaB,SchemaC です。
string
""
スキーマをデータベースからリストすると、負荷がかかる可能性があります。接続文字列でスキーマのリストを提供すると、 パフォーマンスが向上します。
Specify the Square server version to connect with.
string
"v2"
Set this property to v1 to use the Square Connect API v1 or v2 to use the Square Connect API v2.
このセクションでは、本プロバイダーの接続文字列で設定可能なMiscellaneous プロパティの全リストを提供します。
プロパティ | 説明 |
MaxRows | クエリで集計またはGROUP BY を使用しない場合に返される行数を制限します。これはLIMIT 句よりも優先されます。 |
PseudoColumns | このプロパティは、テーブルのカラムとして疑似カラムが含まれているかどうかを示します。 |
Timeout | タイムアウトエラーがスローされ、処理をキャンセルするまでの秒数。 |
クエリで集計またはGROUP BY を使用しない場合に返される行数を制限します。これはLIMIT 句よりも優先されます。
int
-1
クエリで集計またはGROUP BY を使用しない場合に返される行数を制限します。これはLIMIT 句よりも優先されます。
このプロパティは、テーブルのカラムとして疑似カラムが含まれているかどうかを示します。
string
""
Entity Framework ではテーブルカラムでない疑似カラムに値を設定できないため、この設定はEntity Framework で特に便利です。この接続設定の値は、"Table1=Column1, Table1=Column2, Table2=Column3" の形式です。"*=*" のように"*" 文字を使用して、すべてのテーブルとすべてのカラムを含めることができます。
タイムアウトエラーがスローされ、処理をキャンセルするまでの秒数。
int
60
Timeout が0に設定されている場合は、操作がタイムアウトしません。処理が正常に完了するか、エラー状態になるまで実行されます。
Timeout の有効期限が切れても処理が完了していない場合は、Cloud は例外をスローします。