Skip to main content
Measure Cross-silo Collaboration with the API
Joel Bradley avatar
Written by Joel Bradley
Updated over a week ago

Admin privileges required

Applies to: Business

Enterprise users can access their documentation here. Find your plan.


Overview

One of the key benefits of Stack Overflow for Teams is its ability to break down "silos" and help your company's departments and locations share information. The Stack Overflow application programming interface (API) can help you build reports quantifying how your various departments are sharing information.

By using Stack Overflow Teams for reporting purposes, you can:

  • Use the Stack API calls to get data on users, questions, and answers.

  • Use your company HR data or API to decorate the users with segmentation data.

  • Use your favorite data wrangling or data engineering methods to merge the data in beneficial ways.

  • Prepare impactful data visualizations that will show your key stakeholders how Stack Overflow is benefitting your business.

Use API calls to pull data on users, questions and answers

The graphic below shows the relationship of the data inside Stack Overflow's Q&A model:

While the API makes all of these elements available, we recommend starting with a small subset of the data. From there, you can build the size and complexity of your reports based on business needs. For this article, we'll start with the basis of collaboration: users helping each other by asking and answering questions.

Set up API access
The Stack Overflow for Teams API article details how to set up API access and perform your first request. Use the steps in that article to connect to the Stack Overflow API.

Build API calls
You can use the API sandbox to create and test your API calls.

  1. Scroll down the page to see the various endpoints the API offers.

  2. Click on the posts endpoint.

In the Stack Overflow data model, questions and answers are both considered posts. To pull sample post data from the API, click Run.

If you’d like to change which fields the API returns, click [edit] (next to "default filter"). Make your changes and click save. If you want to use the same filter for future API calls, copy and save the filter parameter that the API sandbox adds to the query (for example filter=!nKzQUR0lbv).

The wrapper object
The Stack Overflow API returns results in a wrapper object.

The wrapper object reveals information about your data set, such as the has_more element for pagination. If has_more is true, you can make additional API calls while incrementing the page value to retrieve the rest of the data. When has_more is false, you've retrieved all the available data.

You may want to write your own wrapper around the API results to speed up the API development and reporting process.

Download user information
Your collaboration report will benefit from additional user data, which you can download from your site in CSV format. Navigate to Admin settings, then Users and permissions on your Stack Overflow site. Click Download CSV to get a list of users. The CSV file will include name, e-mail address, and user ID. You can use the user ID (user_id) to link user data with the post data from your Stack Overflow site.

Perform data analysis and segmentation

You can use additional data from your company's HR database or API to enhance your report with segmentation data. Connect your data engineering method by email address, for example, to establish the aggregated source and target pairs. You can leverage these data sources to prepare visualizations and/or build custom integrations.

Some ideas for data segregation and reporting:

  • Report on asker and answerer departments or locations to show how Stack Overflow is increasing collaboration across barriers.

  • Join Stack Overflow post data and your HR data to show adoption by department or location.

  • Connect the data to your favorite D3.js (Javascript data visualization library) code to show collaboration inside Stack Overflow.

What you build is up to you. Consult the Teams API documentation for guidance and inspiration. Stack Overflow support can only help with questions and errors within the scope of general API usage and connectivity.

d3.js example
A chord diagram offers a unique, visually compelling way to display collaboration between question askers and answerers on your site. Set up correctly, a chord diagram will show bi-directional and proportional flow of interactions aggregated by department or location.

In the example below, the outer band is a colored pie chart showing the proportion of questions asked by department or location. The flow across the diagram shows which department answered the questions. This example shows that the yellow group answered the majority of the blue group's questions.


Need help? Submit an issue or question through our support portal.

Did this answer your question?