How to send bulk API requests using Postman

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Cloud、Server、および Data Center - この記事はすべてのプラットフォームに等しく適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

  

要約

Sometimes, we need to send a large number of REST API requests to an application.

As an example, if we need to archive many issues in Jira, we can use the script in Is there an easy way to archive a lot of issues?, but we don't always have scripts built for the requests we need.

Here we'll detail how to use a CSV file as input to Postman and use that to make the REST API requests.

環境

Any computer with Postman installed, sending requests to any application.

ソリューション

  1. Create a CSV with a header line to use as input.
    In our example, we'll call a PUT request to the /rest/api/2/user method to update a user email in Jira DC
  2. Our CSV looks like this:

    lower_user_name,lower_email_address
    agrant-sd-demo,agrant-sd-demo@example2.com
    jevans-sd-demo,jevans-sd-demo@example2.com
    mdavis-sd-demo,mdavis-sd-demo@example2.com
  3. Download and install Postman - https://www.postman.com/downloads/
  4. Build the request, but replace the parameters by the CSV header with two curly brackets, like {{lower_user_name}}
    Going back to our example, our request looks like this:

    (info) Remember to set the Authorization and the Headers as needed. Usually, we can use our login and password for Basic Auth in the authorization. For POST/PUT methods, usually we need to add the Content-Type header as application/json
  5. Save the request - that will create a collection
  6. Click the "Runner" button on the lower right:
  7. Drag the collection to the "Run Order" panel
  8. In the right portion of the screen, click "Select file" and select the CSV file.
  9. Click the "Preview" button to validate that the parameters are parsed as expected.
  10. Finally, click the run collection button.
  11. Postman will show the result for each of the requests on the screen.


最終更新日 2023 年 6 月 9 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.