# Public API Responses
## Themes
### TileLayer
Object containing details of tile layer to be used as base map
```json
{
url: String, // Tile layer url
projection: String, // Map projection
attributions: String, // Attributions to displayed in map
baseMapId: enum [voyager, darkMatter, positron], // Used internally to identify the type of basemap or tilelayer used, Currently 3 possible values (source: https://github.com/CartoDB/basemap-styles)
}
```
### Themes API response
Response structure of https://public-test.mapsted.com/api/swagger/api-docs/#/Themes%20V1/get_api_v1_themes API endpoint
```json
[
{
_id: String, // mongo id of theme from theme collection
dark: Boolean, // Whether the theme is dark mode or not, if true use dark icons on the map or other dark mode related assets
tileLayer: TileLayer,
active: Boolean, // Status of theme, if false not to be used or displayed in themes list
name: {
[language code enum e.g. 'en']: String, // Name of the theme
},
syncId: String,
propertyId: Integer,
companyUID: String
}
]
```
Example response object
```json
[
{
"_id": "639892270697d6198c8b9117",
"dark": false,
"tileLayer": {
"url": "https://basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png",
"projection": "EPSG:3857",
"attributions": "\n <a href=\"https://openlayers.org\" target=\"_blank\" rel=\"noopener noreferrer\">Open Layers</a> |\n © <a href=\"https://cartodb.com/attributions\" target=\"_blank\" rel=\"noopener noreferrer\">Carto Light All</a> | \n © <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noopener noreferrer\">OpenStreetMap</a> \n ",
"baseMapId": "positron"
},
"name": {
"en": "theme_1"
},
"active": true,
"companyUID": "8c77b3e6-b973-48c8-a378-863c05080c7d",
"propertyId": 95,
"syncId": "639892270697d6198c8b8f60"
},
{
"_id": "639892270697d6198c8b9118",
"dark": false,
"tileLayer": {
"url": "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png",
"projection": "EPSG:3857",
"attributions": "\n <a href=\"https://openlayers.org\" target=\"_blank\" rel=\"noopener noreferrer\">Open Layers</a> |\n © <a href=\"https://cartodb.com/attributions\" target=\"_blank\" rel=\"noopener noreferrer\">Carto Voyager</a> | \n © <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\" rel=\"noopener noreferrer\">OpenStreetMap</a> \n ",
"baseMapId": "voyager"
},
"name": {
"en": "Theme_2"
},
"active": true,
"companyUID": "8c77b3e6-b973-48c8-a378-863c05080c7d",
"propertyId": 95,
"syncId": "639892270697d6198c8b8f60"
}
]
```
## Styles
### PolygonStyle
```json
{
fill: { // polygon fill style details
color: String // color code in hex or rgb/rgba format
},
stroke: { // polygon stroke style details
color: String, // color code in hex or rgb/rgba format
width: Integer
}
}
```
e.g.
```json
{
"fill": {
"color": "#EDEDED"
},
"stroke": {
"color": "#C9C9C9",
"width": 2
}
}
```
**Note**: The color code can also be rgb or rgba (incase there is less that 1 opacity) value too like "rgb(188, 230, 214)"
### TextFontEnum
These are the web safe fonts used currently as options in style creation
```
Arial, sans-serif
Verdana, sans-serif
Tahoma, sans-serif
Trebuchet MS, sans-serif
Times New Roman, serif
Georgia, serif
Garamond, serif
Courier New, monospace
Brush Script MT, cursive
```
### TextStyle
```json
{
size: String, // text font size in px but in string format e.g "11px"
fill: {
color: String // color code in hex or rgb/rgba format
},
fontName: TextFontEnum,
font: String, // basically the combination of font and size along with boldness indicator in css font format e.g. "bold 11px Arial, sans-serif"
stroke: {
color: String, // color code in hex or rgb/rgba format
width: Integer
}
}
```
###
e.g.
```json
{
"size": "11px",
"fill": {
"color": "#000000"
},
"fontName": "Arial, sans-serif",
"font": "bold 11px Arial, sans-serif",
"stroke": {
"color": "#FFFFFF",
"width": 2
}
}
```
### LayerStyle
```json
{
layerName: String,
layerIdx: Integer,
spatialIndex: Boolean,
overlayLayer: Boolean,
minZoomLevel: Integer,
maxZoomLevel: Integer,
defaultOpacity: Integer,
customOpacityPerZoomLevel: Array(Float)
}
```
e.g
```json
{
"layerName": "Structures",
"layerIdx": 3,
"spatialIndex": true,
"pverlayLayer": false,
"minZoomLevel": 14,
"maxZoomLevel": 24,
"defaultOpacity": 1,
"customOpacityPerZoomLevel": []
}
```
### PropertyStyleSettings
```json
{
[entityType: Integer]: { // style details of an entity type
[subEntitytype: Integer]: { // style details of all the sub entity types will be listed down like this
name: String, // sub entity type name
polygon: {
default: PolygonStyle, // it is guaranteed that all subentity polygon styles will have 'default' field
selected: PolygonStyle, // selected and vacant is not mandatory, so only need to be applied if it is applicable for that entity:subentity type
vacant: PolygonStyle
},
text: { // text style may exist based on the entity and subentity type and maybe missing in most since it is not applicable to all entity types
default: TextStyle,
selected: TextStyle,
vacant: TextStyle
},
layerIdx: Integer
}
},
// all entity types which can be displayed at property level will be listed down in above object structure
layerStyles: Array(LayerStyle),
default: { // default settings are used as fallback options, if requried style settings are not available in the above entity:subentity fields use default polygon or text style settings
polygon: {
default: PolygonStyle // currently this is empty object since all entity:subentity types have polygon style settings
},
text: {
default: TextStyle
},
icon: {
opacity: Float,
scale: Array(Float)
}
}
}
```
### BuildingStyleSettings
Its structure is identical to PropertyStyleSettings, the number of entity and subentity types may vary
### Styles API response
Response structure of https://public-test.mapsted.com/api/swagger/api-docs/#/Themes%20V1/get_api_v1_themes_styles API endpoint
```json
{
property: PropertyStyleSettings,
building: BuildingStyleSettings,
tileLayer: TileLayer, // same structure as tileLayer field in the first API response
themeDetails: { // details of theme this style settings belong to, contains similar data as Themes retrieval API response
_id: String, // mongodb id
name: {
[language code enum e.g. 'en']: String, // Name of the theme
},
dark: Boolean
}
}
```
Since the response object is too big I have not added any example here, please refer any response object after accessing the API