February 8, 2018 By jason-mcalpin 2 min read

From new account to running code in 5 minutes with serverless Templates

Using Templates for IBM Cloud Functions, you can start building serverless apps in less than 5 minutes. Literally.

What is a Template?

IBM Cloud Functions has just released a catalog of Templates to help you jump start your next serverless application. Templates can be any combination of Actions, Triggers, and Sequences connected together to form a solution. With Templates, you can quickly and easily create actions and start coding right away. Some of the Templates will require service instances from IBM Cloud. There are different Templates available, from printing new item information whenever a new item is added to a Cloudant database to setting up a periodic trigger connected to slack.

Once you’ve deployed the Template, make your own edits to the provided code, and it will quickly become your own! You can go check out the catalog of available Templates or follow along with the instructions for creating your first Template below.

Deploying Templates in IBM Cloud Functions

  1. To create a template, go to IBM Cloud Functions in the console and click ‘Start Creating’.

  2. Click ‘Deploy Template’.

  3. Select the Template you would like to create. For now, let’s try out the ‘Get HTTP Resource’ template. This template will deploy an action to fetch an external resource — in this case the Yahoo Weather API — and then return data. You might want to use a pattern like this when building a backend for a web application, especially if the resource you’re accessing needs an API Key or credentials that you don’t want exposed in your front end app or if the resource is not CORS aware.

  4. The action is enabled as a Web Action, which allows it to be invoked via a URL without an authentication key. Check out the code, and then click ‘Deploy’.

  5. Once you’ve deployed the action, click the ‘Endpoints’ tab and copy the Web Action public URL. You can now paste that URL into your browser to see this action working.

  6. If you don’t pass in a parameter, the action will return the weather for Vermont since that is set in the code as the default. You could also provide a parameter with a location to get the weather for a different location:https://{APIHOST}/api/v1/web/{QUALIFIED ACTION NAME}?location=Austinhttps://{APIHOST}/api/v1/web/{QUALIFIED ACTION NAME}?location=Miami

  7. You should see the weather for your chosen location!  The action received the request from your browser, then made a call to the weather API, and returned with a response.

What’s Next?

We’re excited to see this catalog grow as we continue to add Templates that are useful to you. Is there something specific you would like to see created as a Template? Feel free to share in the comments below, or by reaching out directly to our team!

Learn more about IBM Cloud Functions

 

More from Announcements

Success and recognition of IBM offerings in G2 Summer Reports  

2 min read - IBM offerings were featured in over 1,365 unique G2 reports, earning over 230 Leader badges across various categories.   This recognition is important to showcase our leading products and also to provide the unbiased validation our buyers seek. According to the 2024 G2 Software Buyer Behavior Report, “When researching software, buyers are most likely to trust information from people with similar roles and challenges, and they value transparency above other factors.”  With over 90 million visitors each year and hosting more than 2.6…

Manage the routing of your observability log and event data 

4 min read - Comprehensive environments include many sources of observable data to be aggregated and then analyzed for infrastructure and app performance management. Connecting and aggregating the data sources to observability tools need to be flexible. Some use cases might require all data to be aggregated into one common location while others have narrowed scope. Optimizing where observability data is processed enables businesses to maximize insights while managing to cost, compliance and data residency objectives.  As announced on 29 March 2024, IBM Cloud® released its next-gen observability…

Unify and share data across Netezza and watsonx.data for new generative AI applications

3 min read - In today's data and AI-driven world, organizations are generating vast amounts of data from various sources. The ability to extract value from AI initiatives relies heavily on the availability and quality of an enterprise's underlying data. In order to unlock the full potential of data for AI, organizations must be able to effectively navigate their complex IT landscapes across the hybrid cloud.   At this year’s IBM Think conference in Boston, we announced the new capabilities of IBM watsonx.data, an open…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters