This repository includes an example Apodini web service, a shared Swift Package, and an iOS App that can be used as a starting point for an Apodini web service.
You can start the Apodini example web services on any system that supports docker and docker compose. Follow the instructions on https://docs.docker.com/compose/install/ to install docker and docker compose.
To start and test the web service, you can run the $ docker compose up command to start the web service.
Xcode 13 (only available on macOS) is required to build and run the example client application. Follow the instructions on https://developer.apple.com/xcode/ to install the latest version of Xcode.
- Opening the Example.xcworkspace. The workspace bundles the web services and the client application.
- Select the WebService target, and then the App target and start the web service as well as the app by following the instructions on Running Your App in the Simulator or on a Device
The example system features an example application to manage contacts and their residences. Please note that this is a demo system and does not include any authentication or authorization mechanisms. It uses a database to save the contacts and residences on the web service and includes examples of sharing code between a web service and the client application.
You can test out the API by starting up the web service using the $ docker compose up command.
Create a New Contact Entry:
POST at /contacts, e.g. http://localhost/contacts with a payload encoded in JSON (header Content-Type set to application/json) that encodes a contact:
{
"birthday": 648225181.40703702,
"name": "Paul"
}You can try out the following curl command to set a request to the gateway:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"birthday": 648225181.40703702, "name": "Paul"}' \
http://localhost/contactsGet All Contacts or a Contact by ID
GET at /contacts, e.g. http://localhost/contacts that returns the stored contacts.
You can try out the following curl command to get a list of contacts:
curl http://localhost/contactsYou can get a single contact using GET at /contacts/{contactID}, e.g. http://localhost/contacts/E621E1F8-C36C-495A-93FC-0C247A3E6E5F that returns the stored contacts.
You can try out the following curl command to get a contact by ID:
curl http://localhost/contacts/E621E1F8-C36C-495A-93FC-0C247A3E6E5FUpdate an Existing Contact:
POST at /contacts/{contactID}, e.g. http://localhost/contacts/E621E1F8-C36C-495A-93FC-0C247A3E6E5F with a payload encoded in JSON (header Content-Type set to application/json) that encodes a contact:
{
"birthday": 648225181.40703702,
"name": "Paul Schmiedmayer"
}You can try out the following curl command to set a request to the gateway:
curl --header "Content-Type: application/json" \
--request PUT \
--data '{"birthday": 648225181.40703702, "name": "Paul Schmiedmayer"}' \
http://localhost/contacts/E621E1F8-C36C-495A-93FC-0C247A3E6E5FDelete a Contact
You can delete a contact using DELETE at /contacts/{contactID}, e.g. http://localhost/contacts/E621E1F8-C36C-495A-93FC-0C247A3E6E5F.
You can try out the following curl command to delete a contact:
curl --request DELETE \
http://localhost/contacts/E621E1F8-C36C-495A-93FC-0C247A3E6E5FCreate a New Residence for a Contact:
POST at /residencies/, e.g. http://localhost/residencies with a payload encoded in JSON (header Content-Type set to application/json) that encodes a contact:
{
"address": "Munich",
"contact": {
"id": "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
},
"country": "Germany",
"postalCode": "80331"
}You can try out the following curl command to set a request to the gateway:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"address": "Munich", "contact": {"id": "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"}, "country": "Germany", "postalCode": "80331"}' \
http://localhost/residenciesGet All Residence or a Residence by ID for a Contact
GET at /residencies, e.g. http://localhost/residencies that returns the stored residencies.
You can try out the following curl command to get a list of contacts:
curl http://localhost/residenciesYou can get a single residencie using GET at /residencies/{residencieID}, e.g. http://localhost/residencies/E621E1F8-C36C-495A-93FC-0C247A3E6E5F that returns the stored residence.
You can try out the following curl command to get a residence by ID:
curl http://localhost/residencies/E621E1F8-C36C-495A-93FC-0C247A3E6E5FDelete a Residence by ID for a Contact
You can delete a residence using DELETE at /residencies/{contactID}, e.g. http://localhost/residencies/E621E1F8-C36C-495A-93FC-0C247A3E6E5F.
You can try out the following curl command to delete a residence:
curl --request DELETE \
http://localhost/residencies/E621E1F8-C36C-495A-93FC-0C247A3E6E5FYou can use the functionality of the web service using the bundled client application. You can also test the functionality of the app using the bundled unit and UI tests.
Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.
This project is licensed under the MIT License. See License for more information.

