Life Index
Access Restriction
This API is a premium service available only to enterprise tier developers. Please contact Caiyun Sales to purchase.
Get daily life indices (such as air conditioning, allergy, angling, ultraviolet, etc.) for a specified location.
Request
GET https://singer.caiyunhub.com/v3/lifeindexQuery Parameters
| Name | Required | Default | Values | Description |
|---|---|---|---|---|
token | Yes | — | — | API token; this endpoint requires enterprise permission. See Authentication |
longitude | Yes | — | — | Longitude |
latitude | Yes | — | — | Latitude |
days | No | 1 | 1~15 recommended | Number of days; when it exceeds the available days, only the available days are returned. See Notes |
fields | No | all (all indices when omitted) | Comma-separated index type numbers | See LifeIndexType for the enum, e.g. fields=1,2,3; use fields=all to get all indices, but be prepared for new indices to be added over time |
Request Example
bash
curl "https://singer.caiyunhub.com/v3/lifeindex?token={token}&longitude=116.3883&latitude=39.9289&days=1&fields=1,2,3"json
{
"data": [
{
"date": "2022-09-30",
"lifeindex": [
{
"type": 1,
"level": 2,
"desc": "Comfortable",
"detail": "Very few people need to turn on the air conditioner"
},
{
"type": 2,
"level": 2,
"desc": "Allergy-prone",
"detail": "Sensitive people are prone to allergies"
},
{
"type": 3,
"level": 6,
"desc": "Excellent for fishing",
"detail": "Excellent weather conditions, very favorable for fishing"
}
]
},
{
"date": "2022-10-01",
"lifeindex": [
{ "type": 1, "level": 1, "desc": "Cool", "detail": "No need to turn on the air conditioner" },
{
"type": 2,
"level": 2,
"desc": "Allergy-prone",
"detail": "Sensitive people are prone to allergies"
},
{
"type": 3,
"level": 6,
"desc": "Excellent for fishing",
"detail": "Excellent weather conditions, very favorable for fishing"
}
]
}
]
}Response Fields
GetDailyLifeIndexResponse
| Field | Type | Description |
|---|---|---|
| data | DailyLifeIndex |
DailyLifeIndex
| Field | Type | Description |
|---|---|---|
| date | string | Date in the local timezone |
| lifeindex | LifeIndexItem | Requested life indices |
LifeIndexItem
| Field | Type | Description |
|---|---|---|
| type | LifeIndexType | Life index type |
| level | int32 | A missing field indicates abnormal data |
| desc | string | Short text description |
| detail | string | Long text description, may be the same as desc |
LifeIndexType
| Name | Number | Description |
|---|---|---|
| UNKNOWN_LIFEINDEX | 0 | |
| AirConditionerIndex | 1 | Air Conditioning Index |
| AllergyIndex | 2 | Allergy Index |
| AnglingIndex | 3 | Angling Index |
| AQIIndex | 4 | Air Pollution Dispersion Condition Index |
| BoatingIndex | 5 | Boating Index |
| CarWashingIndex | 6 | Car Washing Index |
| ColdRiskIndex | 7 | Cold Risk Index |
| ComfortIndex | 8 | Comfort Index |
| DatingIndex | 9 | Dating Index |
| DressingIndex | 10 | Dressing Index |
| DrinkingIndex | 11 | Beer Index |
| DryingIndex | 12 | Drying Index |
| HairdressingIndex | 13 | Hairdressing Index |
| HeatstrokeIndex | 14 | Heatstroke Index |
| KiteIndex | 15 | Kite Flying Index |
| MakeUpIndex | 16 | Makeup Index |
| MoodIndex | 17 | Mood Index |
| MorningExerciseIndex | 18 | Morning Exercise Index |
| NightLifeIndex | 19 | Nightlife Index |
| RainGearIndex | 20 | Rain Gear Index |
| RoadConditionIndex | 21 | Road Condition Index |
| ShoppingIndex | 22 | Shopping Index |
| SportIndex | 23 | Sport Index |
| TrafficIndex | 24 | Traffic Index |
| TravelIndex | 25 | Travel Index |
| UltravioletIndex | 26 | Ultraviolet Index / Sun Protection Index |
| WashClothesIndex | 27 | Laundry Index |
| WindColdIndex | 28 | Wind Chill Index |
| StreetStallIndex | 30 | Street Stall Index |
| TakeoutIndex | 31 | Takeout Delivery Index |
| CyclingIndex | 32 | Cycling Index |
| HotPotIndex | 33 | Hot Pot Index |
| MoldIndex | 35 | Mold Index |
| StargazingIndex | 36 | Stargazing Index |
Notes
days <= 0is treated as 1;days > 15does not raise an error — the response actually returns min(days, available data days), and the available data days are typically 15.fieldsis a comma-separated list of index type numbers; invalid values return a 400 error.- A missing
levelfield indicates abnormal data for that index. detailis a long text description and may be identical todesc.
Errors
Invalid parameter values (such as an invalid index type in fields) return HTTP 400. See Error Messages for more details.