REST API工作项创建 [英] REST API Workitem Create

查看:76
本文介绍了REST API工作项创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在单个REST API调用中创建多个功能(如批量创建)。


目前看起来你只能在每个上创建一个功能/史诗打电话。


https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/create?view=azure-devops-rest -5.0


谢谢

解决方案

您好@NiceVision,


感谢您的光临。


目前来自Azure Devops Rest Api,我们只能创建单个工作项(不是多个工作项):

 POST https://dev.azure.com/ {organization} / {project} / _apis / wit / workitems / 


{type}?api -version = 5.0




但您可以使用 JSON批处理执行操作。


JSON批处理允许您通过将多个请求组合到一个JSON对象中来优化您的应用程序。



批量重新发送sts总是使用 POST 发送到 /


批次端点。



JSON批处理请求正文包含一个具有一个必需属性的JSON对象:requests。 requests属性是各个请求的数组。对于每个单独的请求,都需要id,method和url属性。



id属性主要用作将各个响应与请求相关联的相关值。这允许服务器以最有效的顺序处理批处理中的请求。



方法和url属性正是您在任何给定HTTP的开头看到的内容请求。该方法是HTTP方法,URL是通常将个别请求发送到的资源URL。



单个请求也可以选择包含headers属性和身体财产。这两个属性通常都是JSON对象,如上例所示。在某些情况下,正文可能是base64 URL编码的值而不是JSON对象
- 例如,当正文是图像时。当请求中包含正文时,headers对象必须包含Content-Type的值。


 POST https ://graph.microsoft.com/v1.0/ 

Is there any way to create multiple feature in single REST API Call (like Bulk Create).

Currently it seems like you can create only one feature/epic on each call.

https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/create?view=azure-devops-rest-5.0

Thank you

解决方案

Hi @NiceVision,

Thanks for reaching out .

Currently from Azure Devops Rest Api , we can only create single work item which is( not multiple work item) :

POST https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/


{type}?api-version=5.0


But you can use JSON Batching to perform the operation.

JSON batching allows you to optimize your application by combining multiple requests into a single JSON object.

Batch requests are always sent using POST to the /


batch endpoint.

A JSON batch request body consists of a single JSON object with one required property: requests. The requests property is an array of individual requests. For each individual request, the id, method, and url properties are required.

The id property functions primarily as a correlation value to associate individual responses with requests. This allows the server to process requests in the batch in the most efficient order.

The method and url properties are exactly what you would see at the start of any given HTTP request. The method is the HTTP method, and the URL is the resource URL the individual request would typically be sent to.

Individual requests can optionally also contain a headers property and a body property. Both of these properties are typically JSON objects, as shown in the previous example. In some cases, the body might be a base64 URL-encoded value rather than a JSON object - for example, when the body is an image. When a body is included with the request, the headers object must contain a value for Content-Type.

POST https://graph.microsoft.com/v1.0/


这篇关于REST API工作项创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆