This document provides a step-by-step guide on how to delete users or companies in bulk using Postman, a collaborative API development platform.
In this article:
- Step 1: Generate a public API access token
- Step 2: Set up a new collection in Postman
- Step 3: Add a DELETE request to the collection
- Step 4: Add a GET request to the collection
- Step 5: Create a CSV to identify deletion targets
- Step 6: Run the collection
- See also
Step 1: Generate a public API access token
Postman will require an access token from Productboard to run its scripts. Here's how to generate one:
- Make sure you're signed in to your Productboard workspace as an admin.
- From the bottom of the Main menu, click Settings > Integrations.
- Find and click Access token, which should be at the bottom of the page under APIs.
- Click Add token to create a new token.
- Give the token a useful name, like "Postman - company deletion".
- Copy the token and keep it somewhere secure. You will not be able to copy the token again once you leave this page.
Step 2: Set up a new collection in Postman
Postman is a collaborative API development platform. You'll need to set up a collection within it to house the deletion scripts.
- Go to https://www.postman.com/downloads/ and download the Postman app that best suits your computer.
- Open Postman.
- On the left, on the Collections page, click Create new collection > Blank collection.
Step 3: Add a DELETE request to the collection
Add a DELETE request to the new collection using the following data:
-
For Companies: URL: {{baseUrl}}/companies/{{CompId}}
- For Users: URL:{{baseUrl}}/users/{{UserId}}
-
Variables:
- baseUrl: https://api.productboard.com
- CompId: The name of the column header in the CSV
-
UserId: The name of the column header in the CSV
In the Scripts section, add the following code:
pm.test("Status code is 204", function(){ pm.response.to.have.status(204); })
Step 4: Add a GET request to the collection
Add a GET request to the new collection using the following data:
-
For Companies: URL: {{baseUrl}}/companies/{{CompId}}
-
For Users: URL:{{baseUrl}}/users/{{UserId}}
-
Variables:
-
baseUrl: https://api.productboard.com
-
CompId: The name of the column header in the CSV
- UserId: The name of the column header in the CSV
-
baseUrl: https://api.productboard.com
In the Scripts section, add the following code:
pm.test("Status code is 404", function(){ pm.response.to.have.status(404); })
Step 5: Create a CSV to identify deletion targets
Create a CSV file containing the UUIDs of the companies or users that need to be deleted in bulk. (Note: use the header name as the variable in request URL as mentioned in point 3 and 4)
Step 6: Run the collection
All that's left is to prime and run the collection. To do so:
-
In Postman, on the Collections page, in the Authorization tab, paste the access token you generated back in Step 1, then click Save.
- In the header, on the right side of the screen, click Run > Run collection.
- The Run console will appear. In the Functional tab, under Data file, upload the CSV you made in Step 5, then click Run [collection name].
The collection will run and the records you indicated will be deleted.
See also
- Delete customer data from Productboard
- Import company data via CSV
- Merge redundant users and companies
- Configure custom company data fields