Jump to content

Recommended Posts

Posted

In this discussion https://forums.2600hz.com/forums/topic/9224-get-a-auth-token-shortcut/ there was a mention of the "developer app" in the old Kazoo UI. Per a message in there, I am opening this topic.

 

I found the developer app, pretty cool to see what/how to create code. I realize the 'developer app' wasn't kept up, and that "Postman" is the way to go, but the app had a pretty low bar of playing around with code. I/E, you clicked on stuff and saw what happened. ;)

 

I have tried a few times to play with Postman, and I did read some info in the WIKI on doing "stuff" (API calls), but it definitely didn't have the "ease of use" that the developer app had. 

? Would it be of interest to anyone, to have a "Postman" step by step tutorial? 

 

Having "working" examples/videos have been a great way to learn. i/e "step by step tutorial, on how to fix 'x' " on Youtube. 

If there is enough interest, would a separate workshop/tutorial be worth it for KazooCon in April 2018? (referencing the email sent out on September 22nd...somebody actually reads those anoucements!! :) )

 

Posted

@Darren Schreiber I tend to agree with you about deprecating the Developer's app. It would be difficult to keep up with every expansion request.

The way forward is Postman, but I believe that people feel intimidated by the application. I'd be willing to post some examples here on the forum and entertain questions. 

Posted
47 minutes ago, Darren Schreiber said:

Someone rebuilt the old Kazoo UI developer app, perhaps we could merge that in and maintain it, if you really liked it?

I loved the "ease of use" of the tool. But I agree with @FASTDEVICE

 

1 minute ago, FASTDEVICE said:

@Darren Schreiber I tend to agree with you about deprecating the Developer's app. It would be difficult to keep up with every expansion request.

The way forward is Postman, but I believe that people feel intimidated by the application. I'd be willing to post some examples here on the forum and entertain questions. 

Let's move forward! 

It's just hard when You stuck in "have no clue how to do" land. :) If you would do that, it would help. Hopefully I can look at your examples and created a step by step GIF or Video on this. (oh oh, it sounds like I am committing to something!) Jut an FYI, I have "Postman" installed, but never done a successful "Push" "Pull" or "GET". So your example at that level would be most helpful. 

1 minute ago, Darren Schreiber said:

So actually we built the schemas so that they can have descriptions, and thus be "fed" into a friendlier tool. Let me talk to the UI team about what we can do here.

 

That sounds like moving forward also! 

Posted

The first step, and hopefully the easiest, is to install the application... https://www.getpostman.com/

Once installed, you can create Collections and folders within the Collection. Click on the ellipse ... after you create a Collection to add folders.

I created a Collection called "2600hz" and under that a folder called "Auth Token"

 

 

 

Posted (edited)

The first step, and hopefully the easiest, is to install the application... https://www.getpostman.com/

Once installed, you can create Collections and folders within the Collection. Click on the ellipse ... after you create a Collection to add folders.

I created a Collection called "2600hz" and under that a folder called "Auth Token"

 

Let's get an Auth Token.

On the tabs at the top, use the pull down to select "PUT"

image.png.b77a7e015150c0b2a8f184aaab39e55f.png

then type in the url for the API and configure your Headers as below:

image.png.9f94fcf6c9ba7f367581e8309d6fbc7b.png

Now you need the Body of the request. However, your username:password should be an md5hash. In Linux: "echo -n username:password | md5hash" 

for the MD5 hash, it has to be in "lower case" otherwise it won't work.

image.png.8030f46e053568df644ca0cf82169a6b.png

Lastly, you will need the Auth Token saved to a variable in Postman. Click on Tests and enter the below:

image.png.917e833b89a0187c87c7aec7dab5b3c1.png

var jsonObject = xml2Json(responseBody);
var data = JSON.parse(responseBody);
postman.setGlobalVariable("auth_token", data.auth_token);
tests["Body matches string"] = responseBody.has("auth_token");

 

If you click Send in the blue box, you should then get a response from Kazoo indicating Status "success" and a long auth_token. 

Edited by FASTDEVICE (see edit history)
Posted (edited)

Now lets use Postman to GET users on an account. Replace the <accountnumber> with the actual Kazoo account number.

Notice the {{auth_token)) value for the X-Auth-Token key. This is the variable that was used to store the auth token when the PUT was executed. 

image.png.1dc5cbe24cd0ea3c7de2cf9bc1b2aba4.png

Now save your parameters using Save As... and place the call under a folder. Remember to do the same with the PUT that retrieves and stores the auth token.

The sequence will then be, execute the PUT first to retrieve and store the auth token, and then any command after that utilizing the X-Auth-Token with a value of {{auth_token}}. 

 

Edited by FASTDEVICE (see edit history)
Posted

So I get that Postman is more powerful and a great application, I just think the beauty of the old developer app was that it showed you the basics right there and gave you samples to play with. It was just easier for super quick and simple things.

 

So I agree with @esoare that it would be nice to bring it back.

Posted

@FASTDEVICE don't let @Karl Stallknecht discourage you. What you are doing is golden! Keep up the info! 

an FYI for whomever: for the MD5 hash, it has to be in "lower case" otherwise it won't work. I ran the username:password through an online generator, and 1 made the alphabet Upper Case, and that did not work. 

@Karl Stallknecht we'll see what the @Darren Schreiber and the UI team come up with. :)

on a side note: this is really what the Community is all about! Very much appreciate the pitching in and collaboration...speaking of, have some Points @FASTDEVICE

Posted (edited)
4 minutes ago, FASTDEVICE said:

@Karl Stallknecht Once configured as I'm showing, Postman becomes simple to use. Actually, it will be easier than the GUI and much more extensible. All that is being asked, is give it a try.  

FYI I've been using it for over a year. I'm not fighting against using it. I just think it's good to have both options.

Edited by Karl Stallknecht (see edit history)
  • 2600Hz Employees
Posted

Hi,

Over the years, I have been building a Postman collection of Kazoo APIs that I use for testing purposes when building Monster applications.

It seems like people would be interested in such a collection, and because we would rather not have to work on a Developer app that would be inferior in every way, I just created a quick tutorial on how to import that collection and set up Postman to make it easy to use and automate authentication (specifically, storing the authentication token and reusing it for every request).

Keep in mind that this collection is extensive but not 100% complete and some PUT/POST endpoints are missing.

Link to the tutorial

  • Administrators
Posted

Thanks @azefiel

It's important to note that what is being proposed in the tutorial above IS SAMPLES READY TO PLAY WITH! They are like a pre-loaded collection of examples (but real ones) that you can manipulate and use. They become a collection of every API.

I wonder if we can find somewhere central to keep the postman collections.

 

Posted
On 9/25/2017 at 6:04 PM, FASTDEVICE said:

@Karl Stallknecht Once configured as I'm showing, Postman becomes simple to use. Actually, it will be easier than the GUI and much more extensible. All that is being asked, is give it a try.  

I totally agree with you. Postman is super easy to use, and it would be easier to maintain the examples going forward compared to a Monster UI application.

  • 2600Hz Employees
Posted

Agreed too. Creating a Monster App for that would be inferior in every way to Postman! And check out the tutorial from Joris, it's easy to use and cover a LOT of APIs :) 

Posted (edited)

There is a monster developer app that works just fine.  Not maintained though.  There is one tiny fix needed that has never been merged.

https://github.com/siplabs/monster-ui-apiexplorer/pull/6

I just use Postman now.  Bit of a learning curve but anyone messing around with developer level stuff should not have problems.  Just have to put in the time to learn it.   

It is NOT 'easy' as in "I like using iPhone/Mac because it's easy".  It's easy as in "I develop cloud solutions in Erlang,PHP, Javascript and PostMan is easy".

Edited by amn (see edit history)
Posted (edited)
On 10/2/2017 at 10:03 AM, JR^ said:

Agreed too. Creating a Monster App for that would be inferior in every way to Postman! And check out the tutorial from Joris, it's easy to use and cover a LOT of APIs :) 

There is also the swagger.json file that can be used to import all the API's into PostMan.   Don't see that be mentioned in that tutorial.  That collection.json link seems to be a subset (?) of that.

Edited by amn (see edit history)
Posted (edited)

This post further up + the next post right after is what everyone needs to get started.  That automates the important first step of creating the token.  Can't do anything else until you do that and it's not very practical to try do it manually.  Should be a sticky or added to the 2600hz documentation.

 

Edited by amn (see edit history)
  • 2 months later...
Posted

i tried and got this response

    ... ........
    ......+OO=..
    ....IOOOO8?......
    .:O,.8OO8OO7......
    ..IO.~OOOOO8O.. ..
    ...O8.OOOOOOO8~... .. .
    ...I8=,8OOOO8OO=........
    ....$O.:8OOOOOOO?.......
    ... .8O.OOO8OOOOO8......
    .....7O8.ZOOOOOO8O8,....
    .. ...88I.8OOOOOOOO8:....
      ....:OO7,OOOOOOOOOO:...
          .=OO,$8OOOOOOOO8Z...
          ..$O8.=OOOOOOOOO8O,.......
          ...O8O.ZOOOOOOOO8OO,......
           ...OO8.$OO8OOOOOO8O:.....
           ...?OOO.8OOOOOOOOO8O$...     ..
           ....8OOO.OOOOOOOOOOOO$.... .  . .
           .....8OO7,8OOOOOOOOOO88.........
           .  ...OO8:,OOOOOOOOOOO88..... .
           . ... +8OO++OOOOOOOOOOO88,.....
            ......~8O8.:OOOOOOOOOOOOO.. ..
                ...OO88,$OOOOOOOOOOOOO?...
                  ..8OO8.OOOOOOOOOOOO8O+.... .....
                  ..:88O8.OOOOOOOOOOOOOO+...............
                  ...,OOOO.OOOOOOOOOOOOO88.:O8OO8O:.....
                   ...+OO88.O8OOOOOOOOOO8:Z8OOIIO8O8....
                   .....OO8O.8OOOOOOOOOZ+:8OO8~...=OOZ..
                    ....:O88O.8OOOOOOOO?.?8OOO88~...8O:.
                   ......$OOOO.OOOOOOO.O.$O8O8O8O:..~8D.
                      . ..?OOO?.8OOOO~.8,+OOI:OOO8...7O.. .
                         ..ZOOOZ,8OOO..8+,OO...8OO...:O: ..
                         ...7OO8~.8O8,.88.8O:..8O8:..,8+...
                         .. .ZOOO+,OOO.$8~OOOOOOOO~..+8I..
                         .....8OOO,=88$:88,8O8OO88...8O,.
                          .....OOO8.,OO=8OZ.O8OO8...8O8.. .
                          ......OOO8.I8OZ7O8.8OO?~O8O8,...
                          .  . ..$OO8.~OOOOOO.+OO88O?...
                               ...88OZ.=OOOOO88:....,.....
                                ...8OO8.OOOOOOOOOOOOOO...
                                ....ZOO7.?8OOO8OOOOOOO+..
                                 ....?OO$.=8OOOOOOOOOOO~...
                               .......,OO8.,OO8OOOOOOOO8:..
                                 ..... ~OO+.+88OOOOOOOOOO.......
                                ........=8O$.IOOOOOOOOOOOO... ..
                                      ....OO=.~8OOOOOOOOOO8. .
                                      .....OO,.78OOOOOOOO8O7....
                                       ... .O8+.~OOOOOOOOOO7....
                                      .......D8..+OOOOOOOOO.....
                                       . ... .?8~.OOOOO8O8......
                                       ...... .?8:.?8OO8+.......
                                         . . ....8..I$........
                                        . ..   ............  .
                                                 ....

With some fantasie it might look like a kazoo, but is not a auth token

The base url, is that only server name, or also with http:// and with the /V1 ??

 

image.thumb.png.318f4fb2dc5946c426cc8370079b3b87.png

×
×
  • Create New...