API Reference
Connect Your Website to DotSquare
The DotSquare API is a PHP only service at this point in time. JSON is returned by all API responses, including errors.
Your API version is directly linked to the version of DotSquare that you are running so be mindful of this when upgrading dotSquare. You will need to FTP and initialize the DotSquare API on your web server each time you update to ensure everything functions properly.
API Library
The official dotSquare library is only available in PHP (version 5.6 or higher).
API EndPoint
https://cms.fiveonedevelopment.com/dotsquare/{API-VERSION}/api/
Authentication
Connect your account by including your DotSquare API key in API requests. You can find your DotSquare API key inside DotSquare. Then visit "Developers" → "Account". When connecting to DotSquare, your API key will also be set.
Example Request
\DotSquare\Initialize::connect({API-KEY});
Setting a New API Key
If you have multiple partitions, each partition has it's own API key. Be sure to use the key that correlates to desired partition. You can reset the API Key for the partition you need by simply calling setApiKey().
Example Request
\DotSquare\DotSquare::setApiKey('ds_HerEub8YjMvGOQmdGf0z');
// New key will now be used for all following requests
The Response Object
All DotSquare API responses output JSON objects.
Attributes
boolean
string
integer
list
list
string
string
Example Request
\DotSquare\Geo::getUSZipData([
'us_zip'=>'92101'
]);
Example Response
DotSquare\Geo JSON: {
'success': true,
'message': 'Success',
'http_code': 200,
'data': {
'city': 'San Diego',
'state': 'US-CA',
'lat': 32.726967,
'lng': -117.164709
},
'error': {
// Error Data will be displayed here in the event of an error.
}
}
Errors
DotSquare uses conventional HTTP response codes to indicates the status of an API request result.
Codes in the 500+ are indicative of a dotSquare error.
HTTP Status Codes
DotSquare Error Types
Handing Errors
DotSquare API returns an array of information including elemnt containing success or failure or the call. You can test the "success" key for a true value to determine the status of the result.
If an error is thrown, you can display further error details inside the "error" array.
Example Request
$response = \DotSquare\Geo::getUSZipData([
'us_zip'=>'92101'
]);
Example Response - Error Handing
if($response->success){
// Do Something ...
} else {
$type = $response->error->type;
$debug = $response->error->debug;
}
Initialize
The first connection to DotSquare
This is the first thing that must be done when setting up a dotSquare website if not using our Framework. The DotSquare Framework natively handles this operation in the init.php file.
Arguments
Required
Example Request
\DotSquare\Initialize::connect({API-KEY});
Example Response
DotSquare\Initialize JSON: {
'success': true,
'message': 'Success',
'http_code': 200,
'data': {
'database': {
'host': 'fiveonedevelopment.com',
'user': 'myUsername',
'pass': 'myPassword',
'client_db': 'my_db_name',
'client_db_ecomm': 'my_db_name_ecomm',
'db_connection_id': 2,
'db_token': 'db_XXXXXXXXXXXXXX',
},
'account': {
'ecommerce': true,
'tier': 'multi_partition',
},
'paths': {
'ds_path': 'dotsquare/6.62.0/',
'base_url': '/',
'upload_root_path': 'https://cms.fiveonedevelopment.com/',
'upload_base_url': 'https://cms.fiveonedevelopment.com/',
'ds_root_path': 'https://cms.fiveonedevelopment.com/',
'ds_base_url': 'https://cms.fiveonedevelopment.com/',
'gs_base_url': 'https://api.go-spotter.com/'
},
'UTC_timestamp': 1734780842,
'UTC_offset': -8,
'webspace': 'demoWebspace',
'ds_version': '6.62.0',
'cache_token': 'F5TRDKXwvO2MthyzpQ6r',
'partition_id': 1,
'custom_id': 1,
'salt': 'SsWPMPcWkw4BoWXh6AOe',
'cookie_prefix': 'demowebspace-XXXXX';
'time_zone': 'America/Los_Angeles',
'live_mode': true
},
'error': {
// Error Data will be displayed here in the event of an error.
}
}
Data
Request Social Media, Custom Fields, and more
Use this API class to easily retrieve curated data from our servers.
Example Request
\DotSquare\Data::getSocialData([
'social_id' => 1
]);
Example Response
DotSquare\Data JSON: {
'success': true,
'message': 'Success',
'http_code': 200,
'data': {
1: {
'site_name': 'Facebook',
'domain': 'Facebook.com',
'icon_name': 'fb',
}
},
'error': {
// Error Data will be displayed here in the event of an error.
}
}
Custom Fields
DotSquare allows custom fields objects such as Staff, FAQS, etc. This is useful if you need very specific information about an object to be stored. For more information about custom fields visit the Resource Guide
Returns data about all fields used in your website.
Data Attributes
list
string
string
Ex. int, varchar, decimal, text, binary, datetime.
int
int
Example Request
\DotSquare\Data::getFieldsData();
Example Response
DotSquare\Data JSON: {
'success': true,
'message': 'Success',
'http_code': 200,
'data': {
'num_fields': 3,
'fields': {
0: {
'type_title': 'Short Text',
'type': 'varchar',
'max_length': null,
'max_value': null,
}
1: /* DotSquare Data */,
2: /* DotSquare Data */
},
},
'error': {
// Error Data will be displayed here in the event of an error.
}
}
Edit Mode
In addition to editing website text directly through the dashboard app, in certain cases, DotSquare also allows admins to change app text (displayed on the website) in edit mode. This can make it more intuitive for admins to edit their website. This is natively included in the DotSquare Framework so no extra coding is required unless you wish to create custom features.
An example is if staff is listed with descriptions and titles. With this API, the bio and title for each staff member can be changed in edit mode.
Learn more about DotSqaure's Page Editor App
Arguments
Required
Data Attributes
string
string
string
boolean
int
Example Request
\DotSquare\Data::getEditModeData([
'col_id' => 1
]);
Example Response
DotSquare\Data JSON: {
'success': true,
'message': 'Success',
'http_code': 200,
'data': {
'table_name': 'cms_staff',
'row_target_name': 'id',
'col_target_name': 'title',
'plain_text': false,
'max_length': null,
},
'error': {
// Error Data will be displayed here in the event of an error.
}
}
Organization
Request Information Relevant to the Organization
Use this API class to easily retrieve information about an organizations service areas.
Service Areas
DotSquare allows you to store where a business or organization does business. This is useful in delivery businesses, organizations that have exclusive operations within a geography and more.
You can retrieve all service areas or retrieve a selected service area.
Arguments
optional
optional
optional
Ex. coordinates, zip_code, city, county
optional assoc. array
required [1]
required [1]
optional
required [2]
required [3]
required [4]
optional
optional
Ex. distance, zip_code, city, county, state.
optional
Data Attributes
int
list
string
string
string
string
string
Example Request
\DotSquare\Org::getServiceAreas([
'select_by' => 'coordinates',
'select_arributes' => [
'lng'=>32.7211000000,
'lat'=>-117.1743660000
],
'order_by'=>'distance',
'limit'=>40
]);
Example Response
DotSquare\Org JSON: {
'success': true,
'message': 'Success',
'http_code': 200,
'data': {
'num_rows': 40,
'rows': {
0: {
'zip_code': '92101',
'city': 'San Diego',
'county': 'San Diego',
'state': 'California',
'lng': 32.7211000000,
'lat': -117.1743660000,
'distance': 0.1,
},
1: /* DotSquare Data */,
2: /* DotSquare Data */
},
},
'error': {
// Error Data will be displayed here in the event of an error.
}
}