After the Community Coaching Session: Using Postman

  • 11 January 2024
  • 43 replies
  • 374 views

Userlevel 7
Badge +4

The second Community Coaching session has come and gone, and so many came to learn how to use Postman with their Docebo instance. Thank you all for setting the time aside, these sessions are only great when you show up :)

As promised, to help you get up and going a tad quicker in Postman, I made a Collection to share with security preconfigured, and many common API’s loaded and ready to use. It is a great starter library to use as your getting more comfortable using the program.

 

The JSON file is attached to this post as a zipped file. Download, extract, and use the steps below to import it into your Postman. 

Note: I had to break this post up a bit into the comments below, please look through for appropriate steps.


43 replies

Userlevel 5
Badge +1

@Bfarkas - Whoah. I have now gone through all the steps you outlined and created an Excel workbook that can be refreshed with future exports from the Postman queries. I then used the tutorial below to combine the data from the multiple sheets into one combined sheet which is the product I actually need. I’m going to try to refresh the data and see if everything still works. 

 

This is some serious magic.

Userlevel 7
Badge +4

YESS!!! YOU DID THE THING!!!

 

 

Sorry I skipped out on the details for merging, nice find on the above, keep in mind the way you are importing builds those queries for you, so there is also a built in merge option on them:
 

 

Select the other query from the drop down, and then make sure to update the ‘Join Kind’ to ‘Full Outer’ so it includes all rows of both, you also have to select the columns you want from each which is not clear:
 

 

And then fun fact, you don’t actually need the tables that were created for the previous ones, the connections still live:


 

When it comes to the update, make sure to just replace the files, not delete. You can always remap the query where the file is if needed. Also, I often save these in bundles in a shared online space so i can share with other users.

Finally, I know I mentioned it, but I can’t emphasize enough, set the properties of each query to update on document load, its lovely. :)

 

 

Userlevel 5
Badge +1

No worries! I’m a fan of Chester Tugwell’s videos. They’re always very clear!

But I’m going to try your version now. And I’m going to double-check that I set the query properties for update on reload. 

SO EXCITED!

Userlevel 5
Badge +1

I’ve used the Power Query merge before, so the merge method you mentioned looks familiar. But it looks like I can only merge two sheets. And since I have 5 sheets, I think I’ll stick with my version.

Userlevel 7
Badge +4

I’ve used the Power Query merge before, so the merge method you mentioned looks familiar. But it looks like I can only merge two sheets. And since I have 5 sheets, I think I’ll stick with my version.

Makes sense, you can kind of merge both methods too :) but on this almost long weekend, you have a solve so go grab your beverage of choice, cheers!

Userlevel 5
Badge +1

Now continuing I can almost hear your next question @JKolodner , but I only connected one file and Docebo API is making me page it out….annoying right?

Well, here’s a nice thing, you can repeat the excel process again, inside the same excel, with multiple JSON’s. On that query/connection panel on the right, if you right click one of them, there is an option to ‘Merge’. SO you could put all the pieces together and merge them into one giant table within excel, and then you would just need to add new files.

 

Ah, I think you’re saying here that I could merge two, then merge the 3rd one in, then the 4th, then the 5th. Clever!

Userlevel 7
Badge +6

Hello! Is a recording of the session (or today’s DU live) available for my team members who missed it?

Thanks!

Userlevel 7
Badge +4

Yup, @lrodman this one is here:

 

Today’s will be available soon, along with the other DU Lives. This post usually gets updated with it once ready:

 

Userlevel 2
Badge

@Bfarkas hey, thank you for your guide.

i have this error when i click on “Get new access token”:

{"error":"redirect_uri_mismatch","error_description":"The redirect URI provided is missing or does not match","error_uri":"http:\/\/tools.ietf.org\/html\/rfc6749#section-3.1.2"}

thank you for your help

 

Luca

 

Setting Up Authentication

 

Great, you have successfully imported the collection, in order to use it, make sure to finish configuring the Authorization tab and generate a token. To do that follow these steps:

  1. Select the top level of the Collection ‘Docebo API for Sharing’.
  2. Switch to the ‘Authorization’ tab:

     

  3. Scroll down and fill in the ‘Client ID’ and ‘Client Secret’ fields using the information from your Docebo instance. If you do not know how to get these/configure them, see the next section below.
  4. Make sure to select ‘Save’ in the top right:

     

  5. To help this template be more flexible, we used variables for the base URL throughout, including the Authorization area. You need to enter your domain into that variable. To do this, switch to the ‘Variables’ tab:

     

  6. Enter your domain into the ‘Initial Value’ and ‘Current Value’ box next to the ‘base_url’ variable:

     

  7. Make sure to click ‘Save’ in the top right corner.
  8. Return to the ‘Authorization’ tab.
  9. Now it is time to generate a token, select the ‘Get New Access Token’ button.
  10. Log in if you are not already, if you are select Authorize to proceed:

     

  11. Select ‘Use Token’:

     

  12. Make sure ‘Auto-Refresh’ is toggled on, it should automatically do so:

     

  13. That’s it, you are set to go and run API calls throughout this collection.

 

 

Userlevel 7
Badge +4

This error means the URL you put in Docebo on the OAuth2 configuration page and the URL you have in the authentication tab you referenced above for the redirect do not match, make sure both spots have the same one for postman. 

Userlevel 5
Badge +1

@Bfarkas I just bookmarked this page because it’s that useful. Thanks again and have a great weekend.

Userlevel 6
Badge +2

Hi @Bfarkas, thank you for significantly lowering the entry barrier for Postman. I am using your sessions to learn but also teach others on my team.

I am starting to implement the create Session / Event solution that you shared. But my question is how to create multiple events within a session?

Would I create additional calls in postman? 

  1. Create Event Day1
  2. Create Event Day2
  3. Create Event Day3

Or is there some other way to do it?

Thanks

Userlevel 7
Badge +4

Hi @Bfarkas, thank you for significantly lowering the entry barrier for Postman. I am using your sessions to learn but also teach others on my team.

I am starting to implement the create Session / Event solution that you shared. But my question is how to create multiple events within a session?

Would I create additional calls in postman? 

  1. Create Event Day1
  2. Create Event Day2
  3. Create Event Day3

Or is there some other way to do it?

Thanks

You are on the right track!

Userlevel 6
Badge +2


@Bfarkas - I have an additional question. Some of our events have a break while others do not, below is an example of my one line csv.


My question, how can I get this to work if I have one line that has a break and one that does not?

Meaning event_break_begin and event_break_end would be null / empty?

I haven’t been able to get that to work. It seems like I would have to take it out of the CSV each time.

Was trying to get this question posted before you answered the last one, you beat me to it. 😀

Userlevel 7
Badge +4

So it kind of depends on how you have yourself setup, but I can give the overview and with that you’ll have direction and google as your guide.

You have to be able to pass a true null.


Normally those fields are strings so they are wrapped in quotes. If you had those built into the area it is passing into, you could technically remove them, and then just wrap your text string in quotes when needed, and null when not.

If you are using standard Postman behaviors, there are a bunch of articles online about passing a null value from a CSV though to check out some hacks and workarounds.

The other painful, but simple option is to fracture your sheet in half, one with breaks, one without, not the direction I’d go, too lazy, but it is a direction.

 

Userlevel 6
Badge +2

@Bfarkas - ok, my last try for the day. We have a need to setup 2 sessions a week for this ILT, 2.5 days per session. 

  • Session 1, Monday 8-5 with a break at noon
  • Session 1, Tuesday 8-5 with a break at noon
  • Session 1, Wednesday 8-12 with no break
  • Session 2, Wednesday 1-5 with no break
  • Session 2, Thursday 8-5 with a break at noon
  • Session 2, Friday 8-5 with a break at noon

Below is what I have done to code the first half, and it is not working. The session id is getting passed to the event creation, but the run command wants to run it 3 times for 3 sessions. I am trying to create 1 session and 3 events and then 1 session and 3 events.

I haven’t figured out how to handle the 2nd and 3rd events.

CSV is attached. In the code below is the session creation followed by the day 1, day 2 and day 3 event creations.

{
"instructors": [
{{instructors}}
],
"name": "Installation Training",
"code": "{{session_code}}",
"description": "Installation Training",
"min_enroll": 1,
"max_enroll": {{max_enroll}},
"score_base": {{score_base}},
"enrollment_deadline": "2024-03-01",
"evaluation_type": 0
}

{
"name": "Day 1",
"day": "{{event_day}}",
"description": "Skill Training",
"time_begin": "{{event_time_begin}}",
"time_end": "{{event_time_end}}",
"break_begin": "{{event_break_begin}}",
"break_end": "{{event_break_end}}",
"timezone": "{{event_timezone}}",
"id_classroom": {{id_classroom}},
"id_location": {{id_location}}
}

{
"name": "Day 2",
"day": "{{event_day}}",
"description": "Skill Training",
"time_begin": "{{event_time_begin}}",
"time_end": "{{event_time_end}}",
"break_begin": "{{event_break_begin}}",
"break_end": "{{event_break_end}}",
"timezone": "{{event_timezone}}",
"id_classroom": {{id_classroom}},
"id_location": {{id_location}}
}

{
"name": "Day 3",
"day": "{{event_day}}",
"description": "Skill Training",
"time_begin": "{{event_time_begin}}",
"time_end": "{{event_time_end}}",
"timezone": "{{event_timezone}}",
"id_classroom": {{id_classroom}},
"id_location": {{id_location}}
}

 

Userlevel 7
Badge +4

If I am reading the above right you are trying to add 3 events at the same time in the same call? Don’t believe that endpoint supports that, just one event at a time. To do that, you want to either loop or account for multiple events within the runner. So you could get fancy and write a script that checks for certain conditions before triggering the next item in the run, but the easy way is to essentially duplicate the event request so you have 1 create session, 3 create event in the standard loop. Now of course this breaks down if you are doing different methods or numbers of things. Honestly, these scenarios is why I like using Postman for testing, playing with endpoints, making sure things are working, but larger automations I typically shift to a different application or setup where you can do logics easier without needing to script (you can script, but why?)

 

Back to your prior problem, if these are your setups:

  "break_begin": "{{event_break_begin}}",
"break_end": "{{event_break_end}}",

if you update it to be:

  "break_begin": {{event_break_begin}},
"break_end": {{event_break_end}},

and then add the quotes to your CSV around the time, or null, that should end up working for you, have to avoid “null” as that is not a null, but a string of null which is not an accepted value.

Userlevel 6
Badge +2

Thanks @Bfarkas - I have the quotes sorted out now for the break time, and I have one postman run for creating the sessions and one for creating the events.

I just haven’t sorted out how to pass the list of session_ids from the multiple session creations to the multiple event creations.

For now I have to look at the responses, get the session_ids, and add them to the CSV for creating the events.

One post + session csv file to create a number of sessions.

Get session_ids from output and edit event csv

One post + event csv file to create a number of sessions

Reply