Yearly Hexagram
curl -X POST https://api.astroway.info/v1/iching/yearly \ -H "X-Api-Key: aw_live_..." \ -H "Content-Type: application/json" \ -d '{ "birthDate": "1990-06-15", "birthTime": "14:20", "timezoneOffset": 3, "year": 2027 }'const res = await fetch('https://api.astroway.info/v1/iching/yearly', { method: 'POST', headers: { 'X-Api-Key': process.env.ASTROWAY_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "birthDate": "1990-06-15", "birthTime": "14:20", "timezoneOffset": 3, "year": 2027 }),});const { ok, data, error } = await res.json();if (!ok) throw new Error(error.message);console.log(data);import os, requests
r = requests.post( 'https://api.astroway.info/v1/iching/yearly', headers={'X-Api-Key': os.environ['ASTROWAY_API_KEY'], 'Content-Type': 'application/json'}, json={ 'birthDate': "1990-06-15", 'birthTime': "14:20", 'timezoneOffset': 3, 'year': 2027 },)result = r.json()if not result['ok']: raise RuntimeError(result['error']['message'])print(result['data'])<?phpuse GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.astroway.info/v1/']);$r = $client->post('iching/yearly', [ 'headers' => ['X-Api-Key' => getenv('ASTROWAY_API_KEY')], 'json' => [ 'birthDate' => '1990-06-15', 'birthTime' => '14:20', 'timezoneOffset' => 3, 'year' => 2027, ],]);$result = json_decode($r->getBody(), true);if (!$result['ok']) throw new \RuntimeException($result['error']['message']);print_r($result['data']);A hexagram for a person and a year: the Mei Hua formula with the earthly branch of the year asked about in place of the year of asking and the lunar month, day and hour of birth. Labelled basis: convention: Mei Hua casts for a question, and this annual use is this API’s convention. Returns the full Legge reading and ti/yong.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Comma-separated dotted paths, relative to data, to keep in the response. A path is applied to every element of an array, so planets.name means the name of each planet. Paths that match nothing come back in _fields_unmatched; a list where nothing matches at all is a 400, because an empty object would be a confident wrong answer.
Example
planets.name,planets.longitudeRound every non-integer number in the response to this many decimal places. Integers are left alone, because an id is not a measurement. Ecliptic longitudes ship with fourteen decimals by default; 2 is about a tenth of an arcminute.
Example
4Header Parameters
Section titled “Header Parameters ”Unique per logical operation, kept across retries. For 24 hours from the first request, a repeat with the same key, method, path, body and query string returns the stored response with Idempotent-Replayed: true and costs 0 credits. The same key with a different body or query string is a 409 IDEMPOTENCY_KEY_REUSED; a repeat while the first is still running is a 409 IDEMPOTENCY_IN_PROGRESS. Only 2xx responses are kept. See /idempotency/.
Example
01HXY2A7ZM0ABCDEFRequest Body required
Section titled “Request Body required ”object
Birth time; gives the hour term of the cast.
Hours from UTC at the birthplace; places the lunar birth day. Defaults to 8.
The year the reading is for, by its earthly branch.
Example
{ "birthDate": "1990-06-15", "birthTime": "14:20", "timezoneOffset": 3, "year": 2027}Responses
Section titled “ Responses ”Successful calculation
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Example
{ "ok": true, "data": { "birthDate": "1990-06-15", "year": 2027, "lunarBirth": { "month": 5, "isLeapMonth": false, "day": 23, "hourBranch": "Wei" }, "yearBranch": "Wei", "basis": "convention", "method": "The Mei Hua date formula with the branch of the year asked about in place of the year of asking, and the lunar month, day and hour of birth. A convention of this API, not a method of the Mei Hua Yi Shu, which casts for the moment of a question.", "terms": { "year": 8, "month": 5, "day": 23, "hour": 8, "upperSum": 36, "lowerSum": 44, "upperTrigramNumber": 4, "lowerTrigramNumber": 4, "movingLine": 2, "rule": "Upper trigram: (year + month + day) mod 8; lower: (year + month + day + hour) mod 8; moving line: the same sum mod 6; a remainder of 0 counts as 8 or 6. Trigrams are numbered in the Earlier Heaven order (1 Qian, 2 Dui, 3 Li, 4 Zhen, 5 Xun, 6 Kan, 7 Gen, 8 Kun)." }, "lines": [ { "position": 1, "value": 7, "yang": true, "changing": false } ], "primary": { "number": 51, "name": "The Arousing", "pinyin": "Zhen", "legge": "Kăn", "chinese": "䷲", "lines": [ 1, 0, 0, 1, 0, 0 ], "lowerTrigram": 2, "upperTrigram": 2, "judgment": "Kăn gives the intimation of ease and development. When (the time of) movement (which it indicates) comes, (the subject of the hexagram) will be found looking out with apprehension, and yet smiling and talking cheerfully. When the movement (like a crash of thunder) terrifies all within a hundred lî, he will be (like the sincere worshipper) who is not (startled into) letting go his ladle and (cup of) sacrificial spirits." }, "changingLines": [ { "position": 2, "text": "The second line, divided, shows its subject, when the movement approaches, in a position of peril. He judges it better to let go the articles (in his possession), and to ascend a very lofty height. There is no occasion for him to pursue after (the things he has let go); in seven days he will find them." } ], "resulting": { "number": 54, "name": "The Marrying Maiden", "pinyin": "Gui Mei", "legge": "Kwei Mei", "chinese": "䷵", "lines": [ 1, 1, 0, 1, 0, 0 ], "lowerTrigram": 7, "upperTrigram": 2, "judgment": "Kwei Mei indicates that (under the conditions which it denotes) action will be evil, and in no wise advantageous." }, "focus": { "rule": "One changing line: read that line.", "texts": [ { "hexagram": 51, "part": "line 2", "text": "The second line, divided, shows its subject, when the movement approaches, in a position of peril. He judges it better to let go the articles (in his possession), and to ascend a very lofty height. There is no occasion for him to pursue after (the things he has let go); in seven days he will find them." } ] }, "source": "James Legge, The Yi King, Sacred Books of the East vol. XVI (1882; 2nd ed. 1899), public domain: the Text (judgments and line statements)", "readingRuleSource": "Zhu Xi, Yixue Qimeng (1186), ch. 4, on reading changing lines", "tiYong": { "ti": { "index": 2, "name": "Zhen (Thunder)", "symbol": "☳", "lines": [ 1, 0, 0 ], "pinyin": "Zhen", "chinese": "震", "image": "thunder", "attribute": "movement", "family": "eldest son", "animal": "dragon", "bodyPart": "feet", "earlierHeaven": { "number": 4, "direction": "northeast" }, "laterHeaven": { "number": 3, "direction": "east" }, "phase": "wood" }, "yong": { "index": 2, "name": "Zhen (Thunder)", "symbol": "☳", "lines": [ 1, 0, 0 ], "pinyin": "Zhen", "chinese": "震", "image": "thunder", "attribute": "movement", "family": "eldest son", "animal": "dragon", "bodyPart": "feet", "earlierHeaven": { "number": 4, "direction": "northeast" }, "laterHeaven": { "number": 3, "direction": "east" }, "phase": "wood" }, "relation": "same", "verdict": "Ti and yong share a phase: favourable, the two agree." }, "meiHuaSource": "Mei Hua Yi Shu (attributed to Shao Yong, 11th c.), casting by year, month, day and hour; ti and yong by the five phases" }}Validation error
Example
{ "ok": false, "error": { "code": "INVALID_INPUT", "message": "Validation failed: date: Date must be YYYY-MM-DD", "details": [ { "path": "date", "message": "Date must be YYYY-MM-DD" } ] }}Missing or invalid API key
Example
{ "ok": false, "error": { "code": "INVALID_API_KEY", "message": "Invalid API key" }}