You are on page 1of 12

Recipes

Vol. 2 : Connecting from AirKit

© 2022 Coherent, All rights reserved.


Step 1
Create your app...
Head over to https://www.airkit.com/ and
sign in or sign up!

When you're in, go ahead and hit the


"+ Create New" button, and now pick your
template or start from a blank project.

A Web Flow Boilerplate is a good place to start!

© 2022 Coherent, All rights reserved.


Step 2
Creating a data flow...
To consume a Spark service you'll need a
Data Flow. Click "Connections" in the
side menu and then click "+" next to
Data Flows.

Once it's created the first thing


you'll want to do is give it a
sensible name by clicking where it
says "Data Flow" in the top right.

© 2022 Coherent, All rights reserved.


Step 3
Create your inputs variable...

Under where you renamed your data flow you'll


find an "Inputs" section. Hit the "+" button and
you'll be shown a list of variable types. We'll need
to use the "Any" type.

Then rename the input to something more sensible.

© 2022 Coherent, All rights reserved.


Step 4
Setup your inputs...
Go to your Spark service and into the API
Tester.

In the bottom left corner you'll see the


request inputs. Switch it to "JSON view"
and copy the "Inputs" section which you'll
Then paste it in here:
find here:
• Request
• request_data
• inputs

Yo u can co py it by clicking the little blue clipbo ard


icon next to the "inputs" line!

© 2022 Coherent, All rights reserved.


Step 5
Create your custom type...
Your input box should look a bit like
this now.
If yo u've got any errors start by loo king for
additional brackets!

To finalize your input click the "Save as


Custom Type" button and this will add a
data type to your AirData which you can
use in your forms.

Finally, you'll need to hit this button to


add the connection step to your data flow.

© 2022 Coherent, All rights reserved.


Step 6
Add a Http Request...

Your Spark service is exposed as a


REST API so you'll need to add a
Http Request to connect to it.

You can either search for "Http"


in the search box or drill down
into "Data Requests" to find it.

© 2022 Coherent, All rights reserved.


Step 7
Configure your Http Request...
Add your header information...
First set the Method to POST.

Next get your service URL from Spark...

And add it to the URL field in Airkit...


If yo u nee d a synthetic key talk to yo ur Spark
Admin!

© 2022 Coherent, All rights reserved.


Step 8
Complete the request Body...
The final part of the request ...and then paste it into the Body section on
you need to complete is the Airkit. The very last thing is to replace the
Body. Head over to your Spark inputs section with your Input variable we
service and copy the main created in Step 3!
JSON content from here...

Use this button below the "Bo dy" input to make it easier to edit.

© 2022 Coherent, All rights reserved.


Step 9
Test the request...
Now scroll down to the "Run Results" section
and hit the "> Run" button in the top-right
corner. You should see something like the
result below indicating a successful run.

At the bottom of that panel you'll see a


"Save as Custom Type" button. Go ahead
and click that too to add a
representation of your result to your
AirData.

© 2022 Coherent, All rights reserved.


Step 10
Update your AirData naming...
Head on over to the AitData page and you should see your two auto-generated types
for your inputs and output. I suggest renaming them to make them easier to find in
the future.

© 2022 Coherent, All rights reserved.


Build your application
Start using your service!
Now you have a data flow you can hook up to your Airkit application and start
consuming your Spark service!

Page variables Screen bindings Button action

© 2022 Coherent, All rights reserved.

You might also like