System

Move a WordPress site onto an account key

Second half of connecting a site to an account. The owner picks a key on api.astroway.info/dashboard/connect, which sends the admin back to the site with a one-time code; the plugin exchanges it here, server side, sending its site key in X-Api-Key. The code lives 5 minutes; the same code from the same site key within 10 minutes returns the same answer, so a plugin that crashed before saving can ask again. The site key stops working 24 hours after the exchange. Errors: 400 INVALID_CODE, 410 CODE_EXPIRED, 403 SITE_MISMATCH.

post/site-keys/connect/exchange

Query parameters

fieldsstring

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.

precisioninteger

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.

Request body

codestring required

The one-time code the dashboard appended to the return URL.

site_urlstring uri required

The site home URL, the same one the site key was issued for.

Response

Successful calculation

okboolean

Example response

{
  "ok": true
}

Changes

Changed in 1 of the 29 revisions of this API.1