esoare Posted September 25, 2017 Report Posted September 25, 2017 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!! )
Administrators Darren Schreiber Posted September 25, 2017 Administrators Report Posted September 25, 2017 Someone rebuilt the old Kazoo UI developer app, perhaps we could merge that in and maintain it, if you really liked it?
FASTDEVICE Posted September 25, 2017 Report Posted September 25, 2017 @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.
Administrators Darren Schreiber Posted September 25, 2017 Administrators Report Posted September 25, 2017 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.
esoare Posted September 25, 2017 Author Report Posted September 25, 2017 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!
2600Hz Employees JR^ Posted September 25, 2017 2600Hz Employees Report Posted September 25, 2017 I believe this is the project that took the Kazoo-UI app and ported it for Monster: https://github.com/siplabs/monster-ui-apiexplorer
FASTDEVICE Posted September 25, 2017 Report Posted September 25, 2017 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"
FASTDEVICE Posted September 25, 2017 Report Posted September 25, 2017 (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" then type in the url for the API and configure your Headers as below: 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. Lastly, you will need the Auth Token saved to a variable in Postman. Click on Tests and enter the below: 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 September 25, 2017 by FASTDEVICE (see edit history)
FASTDEVICE Posted September 25, 2017 Report Posted September 25, 2017 (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. 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 September 25, 2017 by FASTDEVICE (see edit history)
Karl Stallknecht Posted September 25, 2017 Report Posted September 25, 2017 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.
esoare Posted September 25, 2017 Author Report Posted September 25, 2017 @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
Karl Stallknecht Posted September 25, 2017 Report Posted September 25, 2017 I wasn't discouraging him, and I appreciated the tutorial. I was just pointing out the fact that it's still more involved than just logging into the GUI.
FASTDEVICE Posted September 25, 2017 Report Posted September 25, 2017 @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.
Karl Stallknecht Posted September 25, 2017 Report Posted September 25, 2017 (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 September 25, 2017 by Karl Stallknecht (see edit history)
2600Hz Employees ... Posted September 29, 2017 2600Hz Employees Report Posted September 29, 2017 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 Darren Schreiber Posted September 29, 2017 Administrators Report Posted September 29, 2017 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.
Tom Posted October 2, 2017 Report Posted October 2, 2017 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 JR^ Posted October 2, 2017 2600Hz Employees Report Posted October 2, 2017 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
Tom Posted October 2, 2017 Report Posted October 2, 2017 I didn't even realize that there was all this Monster UI documentation. This is excellent.
amn Posted October 7, 2017 Report Posted October 7, 2017 (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 October 7, 2017 by amn (see edit history)
amn Posted October 7, 2017 Report Posted October 7, 2017 (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 October 7, 2017 by amn (see edit history)
amn Posted October 7, 2017 Report Posted October 7, 2017 (edited) The most useful feature in PostMan is variables imo. I don't really like how they did it. Not very intuitive. But very powerful feature. Here is a blog post on PostMan variables.http://blog.getpostman.com/2014/02/20/using-variables-inside-postman-and-collection-runner/ Edited October 7, 2017 by amn (see edit history)
amn Posted October 7, 2017 Report Posted October 7, 2017 (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 October 7, 2017 by amn (see edit history)
martin Posted December 12, 2017 Report Posted December 12, 2017 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 ??
Recommended Posts