Nationality Form: Create
Configure the nationality form to create a record.
This is the process we will follow.
CREATE
Add a 'create' data source for creating a single nationality record
Link the key nationality record identifier to this ReST API end-point if necessary
Map the custom variables mapped to the form fields to the data source body fields
Assign this 'create' data source to the data entry form
Configure the app toolbar Add menu to add this data entry form
Test that we can create a nationality using the Add menu and Update button
Add a CREATE Data Source
Open App Studio, open the Data Sources configurator, select the Nationality folder you created previously, then use the add button menu to create a new request:

The Add New Request modal popup form shows asking you to name the request:

Type a meaningful name such as "Create Nationality" and click Save.
The request will be added to your tree view beneath the Nationality folder.
Use this opportunity to drag and drop these requests into CRUD order:

Edit Properties
Edit the properties in the Details tab by referencing this list of ReST API end-points.
URL
https://football-891b.restdb.io/views/CreateNationality
HTTP Verb
The default GET verb/method is not correct for creating a single record using the ReST API and should be set to POST for this specific back-end end-point.
The request should now look like this:

Authorisation
Previously we set up security credentials at the Football folder level, so we can leave this to be set to "Inherit from parent".
We do not need to change anything else.
Body
We will be sending the data in the body of the request, so we configure using the relevant custom variables. Here is the empty Body tab:

We will always use the JSON body format as this gives us maximum control.
From the ReST API specification, we know that this endpoint expects data in the same format as the update request and indeed the same custom variables too:
{
"Name": "<#NationalityName#>",
"Country": "<#Country#>",
"FlagURL": "<#NationalityFlag#>"
}
Send Request
It is best practice to now click this button on the Details tab to send the request to the ReST API.
The problem however is that we would have to create an existing record in order to test this.
The best way of course to test this is to use the actual nationality form we created here, and link that form to this data source request, then we can test it.
Edit Form Properties
Open App Studio, open the Forms configurator, then select the Nationality form:

Click the Edit button to open the form properties modal popup.
Data Sources
Click the Data Sources tab. There are 4 CRUD data sources lines. Click this database icon to assign the Create data source:

This modal popup form appears to allow you to select the previously created data source request. Navigate through the folder hierarchy until you locate this data source request, then click the Select button.
This Create data source request should now appear in the list of assigned data source requests:

If you ever need to remove a data source request from the list, you can use this button:

Now click the Apply button on this form, in order to persist the form properties. The Create data source request you added should be shown in the form properties list:

Note that in the previous section we assigned the custom variables to the form fields, so we do not need to do this again, as our new data source request uses the same custom variables. We also configured the update/save button, which will automatically call the new create data source method where necessary.
Configure Add Menu
A new record can only be created from the app toolbar using the Add drop down menu:

Use this configurator to add this form to this list.
This is what your Add menu should look like in the App Toolbar Configurator after you have created the Nationality form. Note how you will have assigned the form as shown:

Apply
Apply any changes to persist them before testing.
Test
You can now test your configuration by clicking the Add menu button on the toolbar and selecting Nationality:

The Nationality form should open:

Type in a nationality and the respective country. Perhaps choose a fictitious country for testing?
Click the "Click to Upload" image to upload a flag image.
Press the Save button. The form record creation should be confirmed:

Last updated