Перейти до вмісту
AstroWay/api v2.201.6 · docs
усі системи в нормі

Site key for a verified WordPress site

POST
/site-keys
request.sh
curl -X POST https://api.astroway.info/v1/site-keys \
-H "Content-Type: application/json" \
-d '{ "site_url": "https://example.com", "proof_id": "3f1c2a9e-8b7d-4c1e-9f3a-2b6d5e4c1a07", "proof": "q3v1Zk0yX2h8sR5tPwL9mN4bD7cF6gH1jK2lE0aS3uT", "plugin_version": "2.1.0" }'

Issues a key to a site that proves it controls its domain: we fetch the proof from the site’s REST route (/wp-json/astroway/v1/verify?nonce=<proof_id>, or verify_url for plain permalinks) and compare it with the one sent. The key is bound to the host, covers a free set of readings and shares 300 calls an hour with the other installs on the host (at most 5). One key per install (host + home path): a new key for the same install revokes the previous one. Server-side only. No API key needed.

fields
string

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.longitude
precision
integer
<= 15

Round 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
4
Media type application/json
object
site_url required

The site home URL, https only. A subdirectory multisite uses the network home.

string format: uri
proof_id required

UUID v4 the plugin generated for this attempt.

string format: uuid
proof required

32 random bytes, base64url. The site must serve the same value at its verify route.

string
>= 43 characters <= 43 characters
verify_url

The verify REST route when /wp-json/ is not available, e.g. https://example.com/?rest_route=/astroway/v1/verify. Same host as site_url.

string format: uri
plugin_version
string
<= 20 characters
Example
{
"site_url": "https://example.com",
"proof_id": "3f1c2a9e-8b7d-4c1e-9f3a-2b6d5e4c1a07",
"proof": "q3v1Zk0yX2h8sR5tPwL9mN4bD7cF6gH1jK2lE0aS3uT",
"plugin_version": "2.1.0"
}

Successful calculation

Media type application/json
object
ok
boolean
data
object
key
string
nullable
plan
string
nullable
domain
string
nullable
home_path
string
nullable
limits
object
per_hour
number
nullable
endpoints
Array<string>
nullable
replaced_previous
boolean
nullable
Example
{
"ok": true,
"data": {
"key": "aw_live_…",
"plan": "site",
"domain": "example.com",
"home_path": "/",
"limits": {
"per_hour": 300
},
"endpoints": [
"public/chart",
"public/horoscope/*",
"natal-texts",
""
],
"replaced_previous": false
}
}

Validation error

Media type application/json
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

Media type application/json
Example
{
"ok": false,
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API key"
}
}
Корисно?