This Swift Server Generator module of the IBM API Connect Developer Toolkit is provided as a Tech Preview.
Learn more about the developer toolkit here
Supplementary Installation Instructions
Additional prerequisites:
Getting Started
-
Get help on the apic command set:
$ apic -h
-
Create a Swift Server Generator application (take the defaults creates an empty application):
$ apic swiftserver --name notes
-
Change into the Swift Server Generator application directory:
$ cd notes
-
Create a model:
$ apic create --type model-swiftserver --name note
? Custom plural form (used to build REST URL): notes
Let's add some note properties now.
Enter an empty property name when done.
? Enter the property name: title
? Property type: string
? Required? No
? Default? No
? Enter the property name:
-
Start the services for the local unit test environment:
$ apic start
-
Use curl
to invoke the sample application to create a note and then list the notes. Scroll to the right to see the full command :
curl -k -X POST https://localhost:4002/api/notes -H 'X-IBM-Client-Id: default' -H 'X-IBM-Client-Secret: SECRET' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{ "title": "This is my first note" }' -v
curl -k https://localhost:4002/api/notes -H 'X-IBM-Client-Id: default' -H 'X-IBM-Client-Secret: SECRET'