{a cisco spark auth API “shim”}

For those of you who will be creating Spark Bots that need to be able to perform authentication to get an access_token and/or refresh_token without a FrontEnd Authorization flow..currently there is no way to do that..until now.  First however, you have to use a NON-Corporate/SSO Account (@wwt.com accounts do not work as I would imagine other CORP entities): I have a GMAIL account (cscospark@gmail.com) which works perfectly.

How does it work:

curl -H "Content-Type: application/json" -X POST -d '{"user":"spark email","pass": "spark password", "id":"app client_id","secret":"app client_secret","redirectUri":"spark app redirect_uri"}' --insecure https://45.55.244.195/authenticate

If you execute the request with the proper credentials passed in..a JSON object will be returned with an Access_Token and Refresh_Token as referred and commented on here.

If you are interested in perhaps a bit more documentation of the API and/or want to take a look at the code: https://github.com/drkchiloll/cscospark-websvcs.git

{f5 bigIQ 4.5 rest api intro}

The jury is out on technical blogs and perhaps how much longer I’m going to do this (at least for me); I’m thinking of moving everything over to Jekyll just to be closer to github because if I continue this..I’m just going to point you to my project on github anyhow..like today.

For this blog post, I suspect you already know what BigIQ is..However, don’t feel bad, I’ve never programmed an F5 Device (and still haven’t gotten my hands on any part of it yet besides getting controlled devices (BigIP) and Backing them up (which is probably best done using the BigIQ interface to begin with).

Today I wanted to share my Introduction to F5’s BigIQ REST API Authentication scheme..which is somewhat of a Kludge. BigIQ using BASIC Authentication like a lot of the Networking companies (many shops are moving to OAUTH api key + tokens); Basic takes the username:password and hashes the user and pass together as shown (with the : in between them)..However, with BigIQ they take the Authentication process 1 Step Further in the same REQUEST; In the Body of the request you must pass a JSON object like below.

{
  "username" : user,
  "password" : pass
}
//If using LDAP there is one other property which I document in the README file in GITHUB

Normally, when utilizing BASIC Auth, you can GET information from the Very Beginning (/bigiq/bigipdevices). However, before you can start asking for devices, you have to Authenticate; when you Authenticate, BigIQ passes back a Token; this token is then used so that you can interact with the devices BigIQ manages. How are you Following Along? Let’s look at the Request Options Below for Authentication

{
  uri     : HTTPS + /mgmt/shared/authn/login,
  method  : POST,
  //BASIC AUTH
  auth    : { user : user, pass : pass },
  headers : {
    'Content-Type' : 'application/json',
    'Accept'       : 'application/json'
  },
  //Didn't I already Pass that in?
  //This is the Message Body Though..
  json    : { username : user, password : pass }
}

If the request above is successful you are return an Object..and one of the Properties of this Object contains your Token (actually 2 one of the properties is name and the other is token..they both have the same value..hmm). One you have the Token..so something like this below

headers['X-F5-Auth-Token'] = token;

Let me know if you find this post useful in any way..and before I forget..here’s the project on github..

https://github.com/drkchiloll/f5bigiq.git

return sam;

{uccx api: dynamically changing an agents skill}

Product: UCCX 9.x and above (the configuration API wasn’t available until 9.x)
Scenario: An Agents answers calls for CSQ A from 12PM – 6PM and then needs to answer calls for CSQ B from 6:30PM – 8PM.
Problem: In UCCX, the only way for an Agent to be a member of more than one CSQ is to use Skills. In the Post, I will use a very simple demonstration of a Use of the API to Automate the Changing of an Agents Skill in order for that Agent to answer calls from different CSQs (and not overlap).
Disclaimer: This Post assumes you have Node.js installed and the Request Library loaded as a dependency in your project. I’m not going to show you how to install Node and or Request. The code I will leave you is classified as a Minimum Viable Product; for example, it seems as though the NodeJS rendition of the setTime function could cause memory leaks. Use this code at your own risk..Ultimately I wanted to demonstrate the use of the API in a real-world scenario as mentioned here.

I could use many tools to perform this little magic trick..Python, Java, Ruby, etc; today I wanted to break out Node.JS mainly to show you CRUD operations in a different language..and Node is just cool too!
Continue reading

{unity connection api: schedules}

Recently, I’ve had the notion to create some automation tasks for Unity Connection (9.x) using the provided API (apparently it (the api) now goes back to 7.x) that uses REST..I’ve blogged about this before even..in Resetting a User’s VM PIN. Why am I spending time creating automation you might ask? The tasks that must be performed on a week by week basis (for the next 49 weeks) includes: Create a Class of Service, Directory Handler, Schedule (and Schedule Detail of course), GDMs, 2 Call Handlers, a User Template and a partridge in a pair tree..MULTIPLIED by 4..I’ve been doing all this for the past 6 weeks..all by hand..Today I’m going to briefly discuss automating the task of creating Schedules..(the actual Holiday Schedules are already configured..but and this doesn’t show you how to create a Holiday Schedule..but if you follow..then you might get the notion and/or no-how to do this🙂

Before moving on with this, a few disclaimers must be added..this post is really about getting you started with creating Unity Schedules in a bulk fashion..I’m not sure there is any “built-in” methods to do this within Unity itself..unless you use COBRAS (and modify the CSV file?). My other intent is to share some code that might spawn ideas on how to do other interesting things using the API..
Continue reading

{uccx scripting: db get data}

In this follow up post to DB integration in UCCX, we’re finally going to attempt to get our hands dirty..First we’ll start easy and pull out a simple set of data from a single table with an easy sql statement. I also want to utilize the Java Array type in order to hopefully dispel any intimidation you might have toward this object (variable). And lastly, I’m going to write some equivalent Java code around JDBC that does away with the built-in Cisco steps to “open” your mind to the fact that although Cisco has a specific step for something doesn’t necessary require you to use it..(this will obviously be geared to those of you out there with some programming experience..whether it is C, python, perl, php, etc).
Continue reading

{uccx scripting: db subsystem setup}

When I last left you in regards to ‘UCCX DB Integration’ I was talking about the tools that help aid you when you have a project that calls for you to interact with an external DataBase within a UCCX Script. Ok, it has been over 2 months and I still haven’t posted a part 2 in this “sql” series. Last week a friend asked me to help get him started with integrating with an MS SQL Server because as he said it..’it has been a while since I last did this.’

Product: UCCX 8.x + with Premium License, MS SQL Server 2000
Scenario: You need to interact with a MS SQL Server.

Most of this post is going to be in screenshots..at this point there will not be any code (that I leave behind)..as I’m just going to focus on setting up the DB Subsystem and testing the DB Connection from there.. and from the tool I use, which I previously introduced, called RazorSQL. Let’s get started:
Continue reading

{uccx scripting: write xml doc w/o keyword transform step}

This post was inspired by a conversation on the Cisco Technical Support Forums that was originally pinned in 2007 (fwiw I was still in the US Army then).

Can I write an xml document other than using the template file and keyword tranform step?
I have too many values (1000+) to transform, it would take too long to enter them manually in the keyword transform step…

Continue reading