Floor plan to verdicts
curl -X POST https://api.astroway.info/v1/vastu/plan \ -H "X-Api-Key: aw_live_..." \ -H "Content-Type: application/json" \ -d '{ "coords": { "system": "metric", "units": "m" }, "northAngle": 0, "boundary": [ [ 0, 0 ], [ 12, 0 ], [ 12, 9 ], [ 0, 9 ] ], "rooms": [ { "type": "kitchen", "polygon": [ [ 8, 0 ], [ 12, 0 ], [ 12, 3 ], [ 8, 3 ] ] }, { "type": "master-bedroom", "polygon": [ [ 0, 0 ], [ 4, 0 ], [ 4, 4 ], [ 0, 4 ] ] } ], "items": [ { "type": "toilet", "point": [ 11, 8 ] } ], "entrance": [ 12, 6 ] }'const res = await fetch('https://api.astroway.info/v1/vastu/plan', { method: 'POST', headers: { 'X-Api-Key': process.env.ASTROWAY_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "coords": { "system": "metric", "units": "m" }, "northAngle": 0, "boundary": [ [ 0, 0 ], [ 12, 0 ], [ 12, 9 ], [ 0, 9 ] ], "rooms": [ { "type": "kitchen", "polygon": [ [ 8, 0 ], [ 12, 0 ], [ 12, 3 ], [ 8, 3 ] ] }, { "type": "master-bedroom", "polygon": [ [ 0, 0 ], [ 4, 0 ], [ 4, 4 ], [ 0, 4 ] ] } ], "items": [ { "type": "toilet", "point": [ 11, 8 ] } ], "entrance": [ 12, 6 ] }),});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/vastu/plan', headers={'X-Api-Key': os.environ['ASTROWAY_API_KEY'], 'Content-Type': 'application/json'}, json={ 'coords': { 'system': "metric", 'units': "m" }, 'northAngle': 0, 'boundary': [ [ 0, 0 ], [ 12, 0 ], [ 12, 9 ], [ 0, 9 ] ], 'rooms': [ { 'type': "kitchen", 'polygon': [ [ 8, 0 ], [ 12, 0 ], [ 12, 3 ], [ 8, 3 ] ] }, { 'type': "master-bedroom", 'polygon': [ [ 0, 0 ], [ 4, 0 ], [ 4, 4 ], [ 0, 4 ] ] } ], 'items': [ { 'type': "toilet", 'point': [ 11, 8 ] } ], 'entrance': [ 12, 6 ] },)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('vastu/plan', [ 'headers' => ['X-Api-Key' => getenv('ASTROWAY_API_KEY')], 'json' => [ 'coords' => [ 'system' => 'metric', 'units' => 'm', ], 'northAngle' => 0, 'boundary' => [[0, 0], [12, 0], [12, 9], [0, 9]], 'rooms' => [[ 'type' => 'kitchen', 'polygon' => [[8, 0], [12, 0], [12, 3], [8, 3]], ], [ 'type' => 'master-bedroom', 'polygon' => [[0, 0], [4, 0], [4, 4], [0, 4]], ]], 'items' => [[ 'type' => 'toilet', 'point' => [11, 8], ]], 'entrance' => [12, 6], ],]);$result = json_decode($r->getBody(), true);if (!$result['ok']) throw new \RuntimeException($result['error']['message']);print_r($result['data']);Send the outline of a house or plot, the angle to north and the rooms, fixtures and main door as points or polygons, in image pixels (or fractions with the image size) or in metres. Each room gets its bearing from the centre of the wall-aligned mandala, its 8, 16 and 32 sector, its mandala cell and deity, the share of each direction it covers, and the verdict and source /vastu/rooms gives; the door gets its pada and result. Findings come heaviest first with remedies, and the score is version 2: weighted by importance, with a band. Magnetic north needs the declination, walls on the diagonals need the facing side, and an L-shaped plan is warned about rather than averaged. The outline itself is judged too: square or modest rectangle, irregular, or turned off the directions, each with its verse. school sixteen-zone reads from the area centre and judges by 16 zones.
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
object
object
object
Example
{ "coords": { "system": "metric", "units": "m" }, "northAngle": 0, "boundary": [ [ 0, 0 ], [ 12, 0 ], [ 12, 9 ], [ 0, 9 ] ], "rooms": [ { "type": "kitchen", "polygon": [ [ 8, 0 ], [ 12, 0 ], [ 12, 3 ], [ 8, 3 ] ] }, { "type": "master-bedroom", "polygon": [ [ 0, 0 ], [ 4, 0 ], [ 4, 4 ], [ 0, 4 ] ] } ], "items": [ { "type": "toilet", "point": [ 11, 8 ] } ], "entrance": [ 12, 6 ]}Responses
Section titled “ Responses ”Successful calculation
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Example
{ "ok": true, "data": { "language": "uk", "requestedLanguage": "uk", "school": "brihat-samhita", "coords": { "system": "metric", "units": "m" }, "north": { "northAngle": 0, "northReference": "true", "declination": null, "trueNorthAngle": 0 }, "centres": { "grid": { "x": 6, "y": 4.5 }, "area": { "x": 6, "y": 4.5, "insideContour": true } }, "mandala": { "wallAngle": 0, "sides": { "N": { "normalBearing": 0 }, "E": { "normalBearing": 90 }, "S": { "normalBearing": 180 }, "W": { "normalBearing": 270 } }, "orientation": "row 0 is the N side, col 0 the W side, as in /vastu/mandala" }, "brahmasthan": { "from": "grid", "cells": [ [ 3, 3 ], [ 3, 4 ] ] }, "shape": { "rectangular": true, "fill": 1, "proportion": { "ratio": 1.333333, "listed": false, "source": "Mayamata 2.10-14: square, or length over breadth by 1/8, 1/6 or 1/4" }, "offsetFromCardinal": 0, "findings": [] }, "cells": [ { "row": 7, "col": 7, "ring": "middle", "devatas": [ "Sāvitra" ], "outsideContour": false } ], "rooms": [ { "type": "kitchen", "label": null, "placement": "SE", "verdict": "ideal", "basis": "classical", "ideal": [ "SE" ], "source": "Brihat Samhita, tr. N. Chidambaram Iyer (1884) 53.118: kitchen in the south-east. NW as second choice and N as avoided (fire against water) are modern practice", "at": { "x": 10, "y": 1.5 }, "from": "grid", "bearing": 126.869898, "direction": "SE", "sector16": "SE", "sector32": { "index": 11, "centre": 123.75, "from": 118.125, "to": 129.375 }, "cell": { "row": 7, "col": 7, "ring": "middle", "devatas": [ "Sāvitra" ] }, "coverage": { "SE": 0.903, "E": 0.098 } }, { "type": "master-bedroom", "label": null, "placement": "SW", "verdict": "ideal", "basis": "convention", "ideal": [ "SW" ], "source": "Modern practice; no verse places bedrooms", "at": { "x": 2, "y": 2 }, "from": "grid", "bearing": 237.994617, "direction": "SW", "sector16": "WSW", "sector32": { "index": 21, "centre": 236.25, "from": 230.625, "to": 241.875 }, "cell": { "row": 7, "col": 1, "ring": "middle", "devatas": [ "Jaya" ] }, "coverage": { "SW": 0.711, "W": 0.289 } } ], "items": [ { "type": "toilet", "label": null, "placement": "NE", "verdict": "avoid", "basis": "convention", "ideal": [], "source": "Modern practice. Writers agree on never NE and never the centre, and split on where it should go (NW and W against the MahaVastu SSW and WNW), so no direction is marked ideal", "rule": "toilet", "at": { "x": 11, "y": 8 }, "from": "grid", "bearing": 55.00798, "direction": "NE", "sector16": "NE", "sector32": { "index": 5, "centre": 56.25, "from": 50.625, "to": 61.875 }, "cell": { "row": 1, "col": 8, "ring": "outer", "devatas": [ "Parjanya" ] }, "coverage": null } ], "entrance": { "side": "E", "position": 3, "pada": "E3", "devata": "Jayanta", "devataMayamata": "Jayanta", "effect": "Great wealth.", "verdict": "auspicious", "source": "Brihat Samhita, tr. N. Chidambaram Iyer (1884) 53.72", "edgeDistance": 0.041667, "method": "eight-per-side", "at": { "x": 12, "y": 6 }, "wallFraction": 0.333333, "from": "grid", "bearing": 75.963757, "sector32": { "index": 7, "centre": 78.75, "from": 73.125, "to": 84.375 } }, "findings": [ { "priority": 1, "level": "avoid", "basis": "convention", "subject": { "kind": "item", "index": 0, "type": "toilet", "label": null, "placement": "NE" }, "text": "Вбиральня: північний схід, небажано.", "source": "Modern practice. Writers agree on never NE and never the centre, and split on where it should go (NW and W against the MahaVastu SSW and WNW), so no direction is marked ideal", "remedies": [ { "id": "toilet-closed-dry", "effort": "easy", "reversible": true, "basis": "convention", "source": "Modern practice; no verse prescribes it", "action": "Тримайте двері вбиральні зачиненими, кришку опущеною, а приміщення сухим, провітреним і чистим.", "reason": "Звичайна сучасна порада для вбиральні, яку не можна перенести." } ] }, { "priority": 2, "level": "ideal", "basis": "classical", "subject": { "kind": "entrance", "pada": "E3" }, "text": "Головні двері в паді E3: ідеально. Наслідок за віршем: Велике багатство.", "source": "Brihat Samhita, tr. N. Chidambaram Iyer (1884) 53.72", "remedies": [] } ], "scoreVersion": 2, "score": 83, "band": "good", "scoring": { "points": { "ideal": 1, "acceptable": 0.5, "caution": 0.25, "avoid": 0 }, "weights": { "classical": 2, "convention": 1 }, "importance": { "kitchen": 3, "stove": 3, "master-bedroom": 3, "toilet": 3, "entrance": 3, "puja-room": 2, "staircase": 2, "well": 2, "underground-water-tank": 2, "septic-tank": 2, "overhead-tank": 2, "other": 1, "shape": 1 }, "bands": [ { "band": "excellent", "from": 90 }, { "band": "good", "from": 75 }, { "band": "fair", "from": 60 }, { "band": "weak", "from": 40 }, { "band": "poor", "from": 0 } ], "formula": "round(100 * sum(importance * weight * points) / sum(importance * weight)) over findings; null when there are none" }, "warnings": [], "notes": [ "Bearings are read from the centre of the mandala rectangle (centres.grid), the smallest rectangle aligned with the walls; centres.area is the centroid of the outline." ] }}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" }}