List Global Elements
GET /v2/sites/{site_id}/global-elements
Lists all global elements for a Square Online site, or filters for a specific global element by name. This operation returns files under global
from the site
directory of the site.
Permissions: ONLINE_STORE_CUSTOM_THEME_READ
Path parameters
Name | Type | Description |
---|---|---|
site_id | string | Required The ID of the site. |
Query parameters
Name | Type | Description |
---|---|---|
section | string | The name of the global section file to retrieve (without the file extension). Only one of section or container can be specified in the request. If neither is specified, all global elements are returned. |
container | string | The name of the global container file to retrieve (without the file extension). Only one of section or container can be specified in the request. If neither is specified, all global elements are returned. |
Response fields
Name | Type | Description |
---|---|---|
errors | Error [ ] | Any errors that occurred during the request. |
global_elements | SiteGlobalElement [ ] | All global elements or the requested global element. Returns empty object ({ } ) if none are found. |
Example requests
List all global elements:
curl https://connect.squareup.com/v2/sites/site_id0/global-elements \
-H 'Square-Version: 2023-09-25' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json'
Retrieve a specific section:
curl https://connect.squareup.com/v2/sites/site_id0/global-elements?section=section_file_name1 \
-H 'Square-Version: 2023-09-25' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json'
Retrieve a specific container:
curl https://connect.squareup.com/v2/sites/site_id0/global-elements?container=container_file_name1 \
-H 'Square-Version: 2023-09-25' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json'
Example response
{
"global_elements": [
{
"name": "header",
"type": "SECTION",
"properties": "{ \"props\": { \"logo_image\": \"https:\/\/www.squareswag.xyz\/uploads\/b\/790312eec987d204998d01117fa46c52fa2bf79a9ab868f2ed52c877e442312c\/squarelogo_1676390791.png?width=400&optimize=medium\", \"nav_links\": [{ \"type\": \"external\", \"href\": \"https:\/\/squareup.com\/gift\/MLTFZ4MSE6YC9\/order\", \"label\": \"Digital Gift Cards\" }], \"buttonLink\": { \"type\": \"shopAll\", \"label\": \"Shop Now\" }, \"buttonBackground\": \"#f5fc9f\", \"buttonTextColor\": \"#000000\" }}"
}
]
}