Workshop: Applying AI to API Testing across the lifecycle
I hosted a workshop at API Days in Paris about increasing developer productivity by applying AI to API Testing.
I hosted a workshop at API Days in Paris about increasing developer productivity by applying AI to API Testing.
I ran a workshop at API Days London showing how you can use API Testing to test for the OWASP top 10 API Security vulnerabilities.
Cloud functions offer an easy way to build functionality and only pay for the time they are actually running without having to worry about how it will be hosted - you just right the code, save it and it is ready to be invoked. The function can be invoked through an event trigger or as a REST API - in this case I'm going to show how you can trigger a function as part of your API Connect assembly flow - providing an easy way to manage and socialise the functionality you have built.
To call an IBM Cloud function you first need to exchange your IBM Cloud API Key for an IAM access key using the IAM Authentication API.
This is a case of setting up and sending a post request to IBM Cloud IAM, to do this I used a set-variable policy to configure the headers and body followed by an invoke to https://iam.cloud.ibm.com/identity/token. The set-variable looks like this:
- set-variable:
version: 2.0.0
title: setup iam request
actions:
- set: message.headers.content-type
value: application/x-www-form-urlencoded
type: string
- set: message.headers.accept
value: application/json
type: string
- set: message.body
type: string
value: >-
grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=$(iam-apikey)
Once you have this access key you can use this to call your function using the endpoint provided in the UI:
{
For the authentication to the function URL we need to set the Authorization header to Bearer {access_key}
where access_key is from the body of the previous request, so to obtain this we can use a Parse policy to parse the returned json, and then another set-variable policy to configure the headers for the Function invoke. This time the set-variable looks like this:
- set-variable:
version: 2.0.0
title: setup function call
actions:
- set: message.headers.authorization
value: Bearer $(iam.body.access_token)
type: string
- set: message.body
value: $(request.body)
type: any
- set: message.headers.accept
value: application/json
type: string
As you can see we're setting the authorization and accept headers, and passing the original request body from the inbound request. We follow this with an invoke of the function URL and a map, because the JSON returned from the function API includes details on invocation as well as the defined response:
{
The end to end flow looks like this:
{
Here is the complete sample swagger file which can be used in any API Connect deployment, including our new API Connect service on AWS
For the third webinar in our series 'API Design Master Class' I showed how you can use CI/CD with API Connect to manage your API deployments.
The next morning I was up early and decided to head first to the High Line - a park/walkway created from an historic raised rail line which goes along the West Side of Manhatten. It's fantastic to see the way the plants have been selected and seeing trees growing in between the old tracks with different sections having distinct settings from wild prairy to wooded sections providing a relaxed park atmosphere with a unique historic character to it. At the end of the line I headed to the Starbucks Reserve coffee roastery to have a coffee before heading back. I then went back to my hotel and got changed for the warmer day ahead and headed down to the dock for my boat tour. The boat tour took me right out past the Statue of Liberty with great views across the skyline along the way. I then checked out the Drama bookshop and then took the subway up to Central Park where I sat in the park to have my lunch. World Trade Center Then in the evening I went to Hudson Yards which is a really interesting development built over the top of railway yards, making use of land that couldn't previously be used. There's some really innovative sustainability steps been taken in how water and energy are managed and growing trees in shallow soil encouraging their routes to grow horizontally for stability and nutrients.
Hudson Yards - Sustainability Animation from Neoscape on Vimeo.
I then went up to The Edge where you get stunning views across the city. The next day was the AWS Summit which was the reason I was in town. This was a massive event and hugely popular, resulting in long queues for attendees to get in snaking across the entrance foyer and around the block. Fortunately being there as an exhibitor I'd been able to arrive early and prepare before the main entrance opened. IBM had a large booth with 4 demo screens and most of the day I spent here meeting people and talking about our new API Connect on AWS SaaS offering. I also got time to explore the other exhibitors and talk to some of the AWS team which was really interesting and useful. In the evening we had an IBM Client appreciation reception at the classic car club where I met more people and chatted with them surrounded by the impressive car whilst watching the sun go down over the Hudson until it was time for me to head to the airport for my flight home.