You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否在Rally中调用外部API?无需源码实现提交故事时的API交互

Can I call an external API from within Rally (without modifying source code)?

Absolutely! You can pull off this exact workflow—grabbing text from a User Story field, hitting an external GET API, and stuffing the response into another Rally text field—without touching Rally's core source code. Let me walk you through the most practical ways to make this happen:

1. Build a Custom Rally App with the App SDK 2.x

Rally’s App SDK is made for extending the platform without altering its base code. Here’s how to use it for your use case:

  • Create a custom app that either listens for when a User Story is saved, or adds a dedicated button (like "Fetch External Data") to the story’s form.
  • When triggered, use the SDK to pull the text value from your source field.
  • Make a fetch or XMLHttpRequest call to your external API. Heads up: if the API blocks cross-origin requests (most do), you’ll need a simple proxy server to forward the request—this is easy to set up with tools like Node.js or even a serverless function.
  • Once you get the API response, use the SDK’s built-in methods to update your target Rally text field with the new data.
  • Deploy the app to your Rally instance as a dashboard widget, or embed it directly into the User Story form via a custom HTML field.

2. Use Rally Web Hooks + a Middleman Service (Low-Code Option)

If coding a full app feels like overkill, this low-code approach works great:

  • Set up a Rally Web Hook that triggers whenever a User Story is created or updated. This hook will send the story’s data (including your source text field) to an external service.
  • Use a serverless function (like AWS Lambda, Google Cloud Functions, or even a simple Express server) as the middleman. This function will take the data from Rally, make the GET request to your external API, and process the response.
  • Then, the middleman uses Rally’s REST API to push the response data into your target text field.
  • No code needs to live inside Rally here—all logic is in your middleman service, so you’re totally safe from modifying Rally’s core code.

3. Embedded JavaScript in a Custom HTML Field (Quick & Dirty)

If you need a temporary or lightweight solution, you can use Rally’s custom HTML fields to embed small JS snippets (note: this is less reliable long-term since Rally’s UI structure might change with updates):

  • Add a custom HTML field to your User Story form, and include a button like "Populate from External API".
  • The embedded JS will grab the value from your source text field using Rally’s DOM elements, make the API call (again, watch for CORS), and then update the target field by targeting its DOM selector.
  • This is the fastest to set up but comes with more risk of breaking if Rally updates its UI.

Key Things to Keep in Mind:

  • CORS is a Common Hurdle: Direct requests from Rally to most external APIs will fail due to cross-origin restrictions. The proxy/serverless middleman fixes this for methods 1 and 3, and method 2 avoids it entirely since the request is server-side.
  • Permissions Matter: Make sure your app or middleman service has the right Rally API permissions to read and update User Story fields.
  • Test First: Always test this workflow in a non-production Rally environment to avoid messing up live data.

内容的提问来源于stack exchange,提问作者adbar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:07:07