In a previous post on JSON connectivity, itDuzzit’s new JSON feature was shown in the context of input variables. One of the team members felt that this was, to put it mildly, somewhat of a dry introduction, and that an example of calling a JSON web service would be more interesting.
So, let’s say you want to have a duzzit call a Facebook JSON api. First, you need to connect your itDuzzit account to Facebook. Once you’ve done that, create and edit a new duzzit. In the cloud menu, one of the options is “Call a Web Service”:

Dragging “Call a Web Service” into the duzzit will open the web service call action:

The url has been set to the graph.facebook.com/me api, passing an OAuth access token. When you connected your itDuzzit account to Facebook, your itDuzzit account received this token. That’s what the $(User.SiteApiKey) represents. As this is being passed as a url parameter, we’re encoding it using the text.url function. (There are other less terse ways of doing this, but if you like terse, text.url does it.) To “merge” this into the url, we’re wrapping this in the [[ ]] itDuzzit syntax that indicates that this is to be treated as a merge variable.
We’re also setting a header, and indicating that authentication is OAuth. That’s it for configuring the basic call. However, we’d like to see the results of the call, so let’s add a message output and write the http response to it. The “more…” menu provides a convenient way of dropping a message output into the duzzit:

Next, we drag the http-response from the facebook input source into the output:

You can now “Do It” – run the duzzit, and you’ll get a JSON response from Facebook. That’s good, but not as useful as it could be. So here’s the trick – copy the JSON, and then paste it into the “Sample Response” on the “Call a Web Service” action. Here’s what (scrubbed for privacy) this looks like:

Finally, once this is saved, the JSON structures are visible in the input source pane on the left:

You can then drag and drop these individual items into the duzzit, and even do things like loop over array data. So, say we want to loop through education data and get school name and type. After setting up outputs for these (an output list named education, with school and type attributes), we can create this loop:

Now when we “Do It”, we get:
