schemas: READMEs: Centralise "detecting CAPI lag" advice

This commit is contained in:
Athanasius committed 2021-11-04 11:03:51 +00:00
1 parent e0c1ac85fd
commit 1b11519ee7
4 files changed
+28 -16

No files matched your search

+17 -3
View File
@@ -62,13 +62,27 @@ the available endpoints and how they work. There is some
[third-party documentation](https://github.com/Athanasius/fd-api/blob/main/docs/README.md)
by Athanasius.
It is *not* recommended to use CAPI data as the source as it's fraught with
additional issues. EDMarketConnector does so in order to facilitate
obtaining data without the player needing to open the commodities screen.
#### Detecting CAPI data lag
When using the Companion API please be aware that the server that supplies this
data sometimes lags behind the game - usually by a few seconds, sometimes by
minutes. You MUST check in the data from the CAPI that the Cmdr is
docked (`["commander"]["docked"]` is `True`) and that the station and
system (`["lastStarport"]["name"]` and `["lastSystem"]["name"]`) match those
docked, and that the station and system names match those
reported from the Journal before using the data for the commodity, outfitting
and shipyard schemas.
and shipyard schemas:
1. Retrieve the commander data from the `/profile` CAPI endpoint.
2. Check that `commander['docked']` is true. If not, abort.
3. Retrieve the data from the `/market` and `/shipyard` CAPI endpoints.
4. Compare the system and station name from the CAPI market data,
`["lastStarport"]["name"]` and `["lastSystem"]["name"]`,
to that from the last `Docked` or `Location` journal event. If either does
not match then you MUST **abort**. This likely indicates that the CAPI
data is lagging behind the game client state and thus should not be used.
---
+3 -7
View File
@@ -65,13 +65,9 @@ It is *not* recommended to use CAPI data as the source as it's fraught with
additional issues. EDMarketConnector does so in order to facilitate
obtaining data without the player needing to open the commodities screen.
1. Retrieve the commander data from the `/profile` CAPI endpoint.
2. Check that `commander['docked']` is true. If not, abort.
3. Retrieve the data from the `/market` and `/shipyard` CAPI endpoints.
4. Compare the system and station name from the CAPI market data to that
from the last `Docked` or `Location` journal event. If either does not
match then you MUST **abort**. This likely indicates that the CAPI data is
lagging behind the game client state and thus should not be used.
Please read
[the guidance on checking for CAPI lag](README-EDDN-schemas.md#detecting-capi-data-lag)
before utilising CAPI data for EDDN messages.
Note that CAPI `/market` data will sometimes have the `StatusFlasg` per
item, which are defined as optional in this schema (because they're not in
+4 -3
View File
@@ -11,9 +11,10 @@ documentation for a schema such as this.
The primary data source for this schema is the ED Journal event
`Outfitting`.
You MAY also source this data from the CAPI `/shipyard` endpoint. See
[commodity-README.md#using-capi-data](commodity-README.md#using-capi-data)
for guidance on this.
You MAY also source this data from the CAPI `/shipyard` endpoint.
Please read
[the guidance on checking for CAPI lag](README-EDDN-schemas.md#detecting-capi-data-lag)
before utilising CAPI data for EDDN messages.
You only need the `name` key's value for each member of the `modules` array.
+4 -3
View File
@@ -11,9 +11,10 @@ documentation for a schema such as this.
The primary data source for this schema is the ED Journal event
`Shipyard`.
You MAY also source this data from the CAPI `/shipyard` endpoint. See
[commodity-README.md#using-capi-data](commodity-README.md#using-capi-data)
for guidance on this.
You MAY also source this data from the CAPI `/shipyard` endpoint.
Please read
[the guidance on checking for CAPI lag](README-EDDN-schemas.md#detecting-capi-data-lag)
before utilising CAPI data for EDDN messages.
You only need the `name` key's value for each member of the `PriceList`
array (if using Journal, it will be from the `ships` array if using CAPI