Skip to content

Commit b1f4a9c

Browse files
Add API Integration Migration Explanation
1 parent 8037abd commit b1f4a9c

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

docs/more/development/integration-questions/integration-api.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,89 @@ Advance Response Configuration
102102

103103
The Advance response configuration allows to set **Response Item Template for Selection** which can be used to define how the selection of items from the integration will be presented before selection.
104104

105+
106+
Migration from Legacy API Integration
107+
*************************************
108+
109+
During the migration from legacy API integration to the new one, the existing API integrations will be automatically migrated. However, there are some differences between these two types of integrations in how they store the data. Here is how the data is stored in all states of the new API integration and how it was stored in the legacy API integration. There is also an example of the stored data in the legacy ORCID API integration.
110+
111+
**State A Legacy API integration (ApiLegacyIntegration)**
112+
113+
This is how the Legacy API integration stores the data.
114+
115+
**What is stored:**
116+
`IntegrationReply.value` carries:
117+
118+
- an ``id`` (the selected item identifier)
119+
- a ``type``: "IntegrationLegacyType"`
120+
- a ``value`` (the rendered markdown/text you see in the UI)
121+
122+
.. code:: json
123+
124+
{
125+
"type": "IntegrationReply",
126+
"value": {
127+
"id": "0000-0003-3856-1682",
128+
"type": "IntegrationLegacyType",
129+
"value": "**Kryštof** **Komanec** \nORCID: **0000-0003-3856-1682** \n\n\n*Czech Technical University in Prague* \n*Prague University of Economics and Business* \n "
130+
}
131+
}
132+
133+
134+
**State B — Migrated to new schema (but still old data/semantics)**
135+
136+
After we migrate to the new API integration, the existing data will still have the same semantics as before, but it will be stored in a different way.
137+
138+
**What is stored vs legacy:**
139+
140+
- ``id`` is **removed**
141+
- ``type`` becomes `"IntegrationType"` (instead of `"IntegrationLegacyType"`)
142+
- ``raw`` is **introduced but empty**: `"raw": {}`
143+
144+
.. code:: json
145+
146+
{
147+
"type": "IntegrationReply",
148+
"value": {
149+
"raw": {},
150+
"type": "IntegrationType",
151+
"value": "**Kryštof** **Komanec** \nORCID: **0000-0003-3856-1682** \n\n\n*Czech Technical University in Prague* \n*Prague University of Economics and Business* \n "
152+
}
153+
}
154+
155+
156+
**State C — New integration (ApiIntegration) with “raw = HTTP response” semantics**
157+
158+
If we delete the old answer and fill in a new one, or we are filling a new integration question with the new API integration, the data will be stored in a different way. The semantics of the stored data will also be different, as the `raw` field will now carry the raw HTTP response from the API, which can be used in the answer template.
159+
160+
**What is stored**
161+
162+
- ``raw`` = **the actual integration HTTP response item/body** (the “source of truth”)
163+
- ``value`` = **custom text** (if user fills their own text) or **rendered template** (how the answer is presented in the UI, rendered from the ``raw`` data using the answer template)
164+
165+
.. code:: json
166+
167+
{
168+
"type": "IntegrationReply",
169+
"value": {
170+
"raw": {
171+
"credit-name": null,
172+
"email": [],
173+
"family-names": "Komanec",
174+
"given-names": "Kryštof",
175+
"institution-name": [
176+
"Czech Technical University in Prague",
177+
"Prague University of Economics and Business"
178+
],
179+
"orcid-id": "0000-0003-3856-1682",
180+
"other-name": []
181+
},
182+
"type": "IntegrationType",
183+
"value": "**Kryštof** **Komanec** \nORCID: [**0000-0003-3856-1682**](https://orcid.org/0000-0003-3856-1682)\n\n"
184+
}
185+
}
186+
187+
105188
Integration Question - API (Legacy)
106189
***********************************
107190

0 commit comments

Comments
 (0)