Solved

Count of Questions asked by a user?


Userlevel 2

If there a way to get the count of “Ask A Expert” questions raised by every user on the system, we need this to incentivize those who ask questions there by adding to the knowledge base. More like a leaderboard of who asked the most question in a period of time.

icon

Best answer by Anonymous 11 October 2022, 22:35

View original

15 replies

Hi @sanmeetsahni! Love this idea. If you’re on the Builder, Expert, or Enterprise edition of Guru and have the technical knowledge or resources available, you’re able to do this through Guru’s API (see question-created event type). 

Userlevel 2

Hi @Chris Anderson Thank you for the direction, I did try this, however, it’s not giving me the data post 9th September 2021, any suggestions here.

 

The data is available here incase you whish to check

https://docs.google.com/spreadsheets/d/1Gvdw_GIsAelBSo21qWVbgQANxyPkplwbyGjwXNPkUEs/edit?usp=sharing

 

We used this link.

https://api.getguru.com/api/v1/teams/ce3aca53-e8c3-480e-9410-65977225a6fe/analytics

 

I have full Admin access to the platform if this information is of any help to you.

Userlevel 3
Badge

Hi @sanmeetsahni! 👋

This is an awesome idea! Do you have an example of a user who has asked a question since September 9th, that is not showing up in the analytics endpoint? For troubleshooting purposes, it would be helpful to know the email address of a user who has asked a question since that date. Feel free to private message me an example and we can help you figure this out 🙂

Thanks!

Userlevel 2

Hi @Joe Duffy quite a few people have asked questions and created FAQs however the data is not being pulled, I myself created almost 80 FAQs pratap.verma@myoperator.com is another user, vimalpreet.kaur@myoperator.com is another to use as an example.

Userlevel 3
Badge

Thanks @sanmeetsahni!

I think I see what’s happening here. Our API results are paginated, meaning that if you call one of our API endpoints and the result set is large, we split up the response over multiple pages.

In short, when there are subsequent result pages, we will return a response header called “Link”, which contains a URL to the next page of results. If you call that URL using the same authentication, you should see more results.

Here is what the response header looks like: 

<https://api.getguru.com/api/v1/teams/ce3aca53-e8c3-480e-9410-65977225a6fe/analytics?token=RAe2wzWHo13UGFPnAsgls1nxXX4flbLvxwIphTe650gvFbB6GxX_flXiQoiOIBTgPaOrLlD4Jfo8qJojXzTQOJwbZfhIFv-Iwdbu4UVb1aC8n1UNm_aEJg%3D%3D>; rel="next-page"; title="Next Page"; type="application/json"

You’ll want to parse out just the URL from the response header for the next API call:

https://api.getguru.com/api/v1/teams/ce3aca53-e8c3-480e-9410-65977225a6fe/analytics?token=RAe2wzWHo13UGFPnAsgls1nxXX4flbLvxwIphTe650gvFbB6GxX_flXiQoiOIBTgPaOrLlD4Jfo8qJojXzTQOJwbZfhIFv-Iwdbu4UVb1aC8n1UNm_aEJg%3D%3D

Let me know if this makes sense!

Userlevel 2

Hi @Joe Duffy I am unable to see this header, where do I find this?

Userlevel 3
Badge

Hi @sanmeetsahni - 

What are you using to make the API call? 

If you use Postman, you can click on the “Headers” button in the response section after you make the API call. Here is a screenshot: 

If you are using python to make your API call, you can see the response headers by using the print(response.headers) function, similar to the example below:

import requests

url = "https://api.getguru.com/api/v1/{endpoint}"

payload={}
headers = {
'Accept': 'application/json',
'Authorization': 'Basic {token}'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
print(response.headers)

Let me know if either of these help - if not, let me know what method you are using to make the API call and I can give a specific example of how to see the response headers.

Thanks!

Userlevel 2

@Joe Duffy Thank you for the help again, we got the data we needed, however, there is another roadblock, if you see Column B in this sheet it doesn’t show the exact question that was searched, asked or copied, is there any way of getting this as well?

Userlevel 2

Hi @Joe Duffy Anything on my last query?

Userlevel 3
Badge

Hi @sanmeetsahni!

Apologies for the delay in response here.

Admittedly, to get to the question that was asked is a bit wonky. We store our questions as cards, so you can get to it using the /cards endpoint. In your response from the /analytics endpoint, you will see a factId. You can use that ID in the endpoint below to get the question:

GET https://api.getguru.com/api/v1/cards/{factId}

The question will be stored in the preferredPhrase field.

Let me know if this works for you!

Userlevel 2

Hi @Joe Duffy I understand I have a few wacky queries, I am actually trying to get an idea of the TAT for answering the questions asked and hence asking these wacked out questions :P, If you do have an easier way do let me know.

Userlevel 2

Hi @Joe Duffy Any thing on my last query, also wanted to check is there is a way to Export the Guru data in a single sheet in the attached format, current the system is not providing Column B

Userlevel 2

@Joe Duffy Also in Postman we are not getting the Link entry as you can see in this screenshot

 

 

Userlevel 3
Badge

Hi @sanmeetsahni 👋

Column B (“Content”) in your spreadsheet will not be filled in for questions. The question itself is in Column A. 

As for the pagination link, it looks like you are getting a 401 Unauthorized code, which likely means there’s something wrong with your authentication method (username and token). Can you double check those and try again?

Are there any outstanding questions I haven’t answered here? If so, it might make more sense to jump on a call to discuss. I can DM you with a Calendly link if you’d like - let me know!

Userlevel 2

@Joe Duffy I’ll recheck the Token and the username again tomorrow once the team is at work, as for the excel sheet I need the answers to come in column B for the the questions in column A.

How do I get the Questions and Answers in that excel with the other analytics data?

Also, please do share the Calendly along with the answer to this query and if I still have a issue post working with the team tomorrow I’ll will set up a call with you for a one shot conversation and solution. 

Reply