|
| 1 | +--- |
| 2 | +title: Migrating to V2 |
| 3 | +prev: false |
| 4 | +next: false |
| 5 | +--- |
| 6 | + |
| 7 | +XIVAPI v2 represents a from-scratch reimplementation of the service, with a |
| 8 | +heavy focus on stability for consumers, and providing a solid platform for years |
| 9 | +to come. To achieve this, it does not attempt to maintain backwards compatibilty |
| 10 | +with v1. |
| 11 | + |
| 12 | +This document is intended to outline the key differences between v1 and v2, and |
| 13 | +assist in efforts to migrate to the new version. For full documentation of the |
| 14 | +v2 API, refer to the [guides] and [api reference]. |
| 15 | + |
| 16 | +[guides]: /docs/guides/ |
| 17 | +[api reference]: /api/1/docs |
| 18 | + |
| 19 | +## Game Content |
| 20 | + |
| 21 | +Game data, known as "content" and "indexes" in the v1 API, is consistently |
| 22 | +referred to as "sheets" throughout v2. This, along with a few other updated |
| 23 | +names outlined below, aligns the API with common terminology used by the FFXIV |
| 24 | +developer community. |
| 25 | + |
| 26 | +Sheet data access has seen several significant changes, however has _largely_ |
| 27 | +similar semantics, due to sheets being a concrete concept inherited from the |
| 28 | +game files. |
| 29 | + |
| 30 | +### Columns and Filtering |
| 31 | + |
| 32 | +Throughout the v2 API and its documentation, "field" is used to refer to what V1 |
| 33 | +called a "column". This extends to the `fields` object in responses, and the |
| 34 | +`fields=` filtering url parameter. |
| 35 | + |
| 36 | +Filtering fields remains largely similar to v1, with the exception of arrays, |
| 37 | +which are represented through brackets. |
| 38 | + |
| 39 | +```json |
| 40 | +// v1 |
| 41 | +columns=Array.*.Field |
| 42 | +// v2 |
| 43 | +fields=Array[].Field |
| 44 | +``` |
| 45 | + |
| 46 | +### Change of Schema |
| 47 | + |
| 48 | +V2 utilises [EXDSchema] as its [schema]. EXDSchema inherits the vast bulk of the |
| 49 | +names and mappings found in the SaintCoinach schema, which was used by v1 - so |
| 50 | +most fields should be the same or similar to what you're accustom to. |
| 51 | + |
| 52 | +If a field isn't where you expected, you can check the full structure of the |
| 53 | +schema for a sheet by visiting the row endpoint without a field filter, as |
| 54 | +outlined in [the sheets documentation][sheets filtering]. Fields may have |
| 55 | +shuffled slightly to better represent their structure in the game files. |
| 56 | + |
| 57 | +[EXDSchema]: https://github.com/xivdev/EXDSchema |
| 58 | +[schema]: /docs/guides/concepts/#schemas |
| 59 | +[sheets filtering]: /docs/guides/sheets/#filtering |
| 60 | + |
| 61 | +### Transient Fields |
| 62 | + |
| 63 | +While some fields will have moved due to the schema update outlined above, |
| 64 | +others may appear to be completely missing. In many cases, these are "computed" |
| 65 | +fields - that is, fields that do not actually exist on a given sheet, but are |
| 66 | +instead derived based on other data. |
| 67 | + |
| 68 | +In a few instances, these fields actually belong to a seperate sheet, typically |
| 69 | +including the term "transient" in its name. These fields can be included in |
| 70 | +responses through the `transient=` URL parameter, see the [Transient Sheets] |
| 71 | +documentation for further information. |
| 72 | + |
| 73 | +[Transient Sheets]: /docs/guides/sheets/#transient-sheets |
| 74 | + |
| 75 | +### Other Computed Fields |
| 76 | + |
| 77 | +In most other cases, the computed fields are derived in a manner that is |
| 78 | +difficult to represent in a maintainable manner. For this reason, the v2 API |
| 79 | +does not support further computed fields. |
| 80 | + |
| 81 | +If one or more of these computed fields is critical to your use case, please |
| 82 | +reach out on Discord - there may be alternative ways to construct semantically |
| 83 | +equivalent data. Alternatively, you may be able to refer to the implementation |
| 84 | +of these fields in the [v1 codebase][v1 computed] to replicate it with your |
| 85 | +consumption of v2. |
| 86 | + |
| 87 | +[v1 computed]: https://github.com/xivapi/xivapi.com/tree/master/src/Service/DataCustom |
| 88 | + |
| 89 | +### Game Content Links |
| 90 | + |
| 91 | +The v1 API provided a reverse relationship lookup, exposed as the |
| 92 | +`GameContentLinks` field on rows. At present, v2 does not have any equivalent |
| 93 | +functionality, however it is a feature we're interested in adding. As v2 is |
| 94 | +functionally a "lower level" system than v1, it may take a while for a viable |
| 95 | +approach for this to be implemented. |
| 96 | + |
| 97 | +Akin to computed fields, please reach out if this functionality is critical to |
| 98 | +your use case, as alternatives may exist. |
| 99 | + |
| 100 | +## Search |
| 101 | + |
| 102 | +V2 has a single, powerful search endpoint that combines much of the |
| 103 | +functionality found in v1's query string, filters, and advanced Elasticsearch |
| 104 | +queries into one search query syntax. |
| 105 | + |
| 106 | +An introduction to this new syntax can be found in the [Searching Sheets] guide. |
| 107 | + |
| 108 | +[Searching Sheets]: /docs/guides/search/ |
| 109 | + |
| 110 | +## Lodestone |
| 111 | + |
| 112 | +V1 provided endpoints that surfaced data obtained from Lodestone, however these |
| 113 | +endpoints saw degraded availability due to the nature of the scraping being |
| 114 | +performed. By late 2023, they were effectively rendered non-functional. |
| 115 | + |
| 116 | +There are no current plans to re-introduce Lodestone endpoints in v2. For |
| 117 | +alternatives, please see the [Open Souce][lodestone alternatives] page, which |
| 118 | +lists a few tools and libraries that can be used to obtain this information. |
| 119 | + |
| 120 | +[lodestone alternatives]: /docs/software#lodestone-data |
0 commit comments