通知工作项完成,但未在v3上进行轮询

时间:2019-02-05 09:59:01

标签: c# autodesk-designautomation

似乎有一种方法可以实现非轮询机制来完成工作项的完成,如本页所示:https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/basics/ 但是我找不到使用api指定它的方法。我应该在工作项中定义什么以在特定端点上具有回调?

这是我已经拥有的:

var workITem = new WorkItem
            {
                ActivityId = Services.ForgeService.CleanActivityId,
                Arguments = new Dictionary<string, IArgument>
                {
                    {
                        "dwg",
                        new XrefTreeArgument
                        {
                            Url = inputUrl,
                            Verb = Verb.Get
                        }
                    },
                    {
                        "results",
                        new XrefTreeArgument
                        {
                            Verb = Verb.Put,
                            Headers = new Dictionary<string, string>
                            {
                                {"Authorization", $"Bearer {token}"}
                            },
                            Url = outputUrl
                        }
                    }
                }
            };

谢谢。

1 个答案:

答案 0 :(得分:0)

罗曼,

请仔细阅读LearnForge教程

string callbackUrl = "Your Callback Url";
    WorkItem workItemSpec = new WorkItem()
    {
        ActivityId = activityName,
        Arguments = new Dictionary<string, IArgument>()
        {
            { "inputFile", inputFileArgument },
            { "inputJson",  inputJsonArgument },
            { "outputFile", outputFileArgument },
            { "onComplete", new XrefTreeArgument { Verb = Verb.Post, Url = callbackUrl } }
        }
    };