cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Pondering Automation: Writing a SMART API Call

303
Views
0
Helpful
1
Comments
Cisco Employee

Howdy out there in Automation land!!! And a belated Happy 2017 to you all as well. Hopefully the near year has brought you a renewed vigor and you are ready to buckle down and automation more. Today's blog and video are an example of the framework and some of the things I do when making API calls to other applications with CPO. Today we are going to highlight SmartSheet and their API. Smartsheet is an excel/project/general sheet software in the cloud and we are going to look at how we can write a great API call for that API and use it!

 

A couple of key points when writing a smart API call...

 

  1. Understand that just because your process (in CPO) succeeds does not mean your API call was successful or returned the data you needed.
  2. Know how to handle output from your API calls properly and what to (and what to not) give back to an end user who is using your calls
  3. Do your best to cloak information and non-archive as much as possible
  4. Try to use custom target types to separate your API set/calls from the generic Web Target
  5. Use cool icons to show off your API! :)

 

 

So how do we do some of the above??? For error handling we must be able to take the output of the API in and determine whether the call was successful (from an API standpoint) or not. Then alert the end user to that fact. If the API call fails due to authorization or maybe due to an incorrect input, the call will return bad data... however CPO would take that data and pass it on and mark the process as succeeded. Which is technically true, but not what you wanted! So you have to put error handling/exception handling into your code/API framework to be able to deal with this and alert you to that fact. You will see the framework I have setup to handle this. Personally I use a process event trigger setup coupled with my Content Logger.

 

 

What about cloaking data?? Let's make good use of the encrypted string variable type! It keeps things hidden from the end-user in the GUI. Also, do not archive your API calls (process archival). It just creates more "bulk" in the DB and is unneeded. Normally I create a global variable and call it "Debug" and when it's true, I archive, when it's false, I don't!

 

The TAP I have started on the tap emporium post, anyone is welcome to it, knowing it's not supported and opensource content in nature. It does require Content Logger, My Automation Toolkit, and my PO Rest API TAPs as well. All are the same... not supported and opensource in nature. If you have issues with them you can reach out to me or post in the comments.

 

The rest of the points above...well you are just going to have to watch the show! So... ONTO THE VIDEO!

 

Play recording

Password: S0Smart123

 

 

 

 

Standard End-O-Blog Disclaimer:

 

Thanks as always to all my wonderful readers and those who continue to stick with and use CPO. Big things are on the horizon and I hope that you will continue to use CPO and find great uses for it! If you have a really exciting automation story, please email me it! (see below) I would love to compile some stories and feature customers or individual stories in an upcoming blog!!!

 

AUTOMATION BLOG DISCLAIMER: As always, this is a blog and my (Shaun Roberts) thoughts on CPO and automation, my thoughts on best practices, and my experiences with the product and customers. The above views are in no way representative of Cisco or any of it's partners, etc. None of these views, etc are supported and this is not a place to find standard product support. If you need standard product support please do so via the current call in numbers on Cisco.com or email tac@cisco.com

 

Thanks and Happy Automating!!!

 

--Shaun Roberts

shaurobe@cisco.com

1 Comment
Cisco Employee

If you wish to have the smart sheet API pack i have started, please email me! Or check out the TAP emporium once it is re-posted.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.