How to put JSON into Swager so my application could perform GET
Hi! I am on my path of learning and just now reached integration things. Task is to import emploees data from JSON file into app. I allready have that file, have prepared json snippet and mapping and rest – that all works an I have Swaggers page, but dont know where to put that JSON file. Should there be some place for link? Or may be I am looking in wrong place?
You show a ‘get employee’. This allows you retrieve an employee from your application. What you describe to wannahave is a POST employee. That will allow you to insert your JSON and process it to become employee-objects in your app.
Mendix has created nice tools to setup the basics of an interface. Likely the training lets you do too much manually. Here is the quick route:
in your domainmodel, rightclick your entity and ‘Expose as REST’. Click all options;
Now you are done with ‘publishing the employee-api’ :-)
To have a JSON without as little effort as possible:
create a new ‘Message definition’ in project explorer, rightclick a folder and select ‘Other’->’Message definitions’
open the message definition, in the top click ‘Add’ to add your employee object, then click ‘Generate mappings’ to create both im- and exportmappings.