I want to develop a TYPO3 extension with a data model and a corresponding backend form. This backend form should be auto-filled by entering some sort of globally unique ID and fetching the data from an external source based on that ID. If the external source does not return a result or that globally unique ID does not exist, the data can still be added manually.
Is there a way to do that? Or do I have to resort to just storing the GUID locally and fetch the data in the frontend?
For clarification: My usecase are scientific publications and their DOI as a globally unique ID.
Note about my knowledge: I have developed extensions with their own data models, corresponding backend forms, and frontend output. I have also used generic external data (not specific data based on an ID) in such backend forms, fetched via curl. But I have no idea where to start for what I described above.
For a better understanding, consider the following model and workflow:
Data model, simplified
For simplification, let’s assume the model just has the following three properties:
guid– globally unique IDtitle– the title of the dataset, e.g. publicationauthors– the author(s) of the dataset, e.g. publication
Workflow to create a new record
Now, when I add a new record in the TYPO3 backend,
- I want to show an empty field for each of these properties in the “Create” form
- after entering the
guidI want my extension to send a request to an external data source using thisguid, and filltitleandauthorsautomatically from the result of that request - if the request is empty or I have no
guidavailable, I can add the information manually - the whole record will be stored in the TYPO3 database table for my model
Nice-to-have addition
Consider, the external data stored for the guid can change, it would be nice to be able to fetch the external data again via the Edit form of an already locally stored record. However, this will not be necessary very often.
You could use the External Import package for this. The related documentation describes very well how you could integrate your external data source for importing records into TYPO3.
To cover your described case "keep additional records not present in the external data source" you may need to add
deleteto disabledOperations. But first you need to clarify what should happen, if the external data source actually provides data for a record which did only exist locally so far. Should the external data be ignored? Should your local data be overwritten by the external data? Again you can use the configuration to skip records in this case.