如何使用WSO2 EI 6.1.1将文件作为表单数据传递给Zoho Task Creation API

问题描述

我正在使用 zoho api 在Zoho Portal中执行Task Creation在这种情况下,上载文档功能不起作用,但是任务创建成功。

我不知道如何获取表单数据(此处为“ uploaddoc”,即文件)并将其处理到API级别。

邮递员如下图所示:

Postman

任务创建API-代码

<resource methods="POST" uri-template="/createTask?PortalId={portalid}&amp;ProjectId={projectid}">
        <inSequence>
            <log level="custom">
                <property name="Welcome Logger" value="=== Task Creation API Started ==="/>
                <property expression="get-property('uri.var.portalid')" name="uri.var.portalId"/>
                <property expression="get-property('uri.var.projectid')" name="uri.var.ProjectId"/>
            </log>
            <property description="Configuration" expression="get-property('ZohoApp-Config')" name="ZohoAppConfig" scope="axis2" type="OM"/>
            <property expression="get-property('registry','gov:/ZohoConfig/ZohoAppConfigFile.txt')" name="accesstoken" scope="default" type="STRING"/>
            <property description="RefreshToken" expression="$axis2:ZohoAppConfig//*[local-name()='refreshToken']/text()" name="refreshToken" scope="default" type="STRING"/>
            <property description="BaseUri" expression="$axis2:ZohoAppConfig//*[local-name()='PortalDetails']/text()" name="uri.var.BaseURI" scope="default" type="STRING"/>
            <property expression="json-eval($.task_name)" name="uri.var.task_name" scope="default" type="STRING"/>
            <property expression="json-eval($.owner_id)" name="uri.var.owner_id" scope="default" type="STRING"/>
            <property expression="json-eval($.description)" name="uri.var.description" scope="default" type="STRING"/>
            <property expression="json-eval($.priority)" name="uri.var.priority" scope="default" type="STRING"/>
            <property description="URI1" name="uri.var.Projects" scope="default" type="STRING" value="projects"/>
            <property description="URI2" name="uri.var.Tasks" scope="default" type="STRING" value="tasks"/>
            <filter regex="false" source="get-property('uri.var.task_name')=''">
                <then>
                    <header expression="fn:concat('Bearer ',get-property('accesstoken'))" name="Authorization" scope="transport"/>
                    <!-- task Creation Endpoint call without document,need to process form Data related things here-->
                    <call>
                        <endpoint>
                            <http method="post" uri-template="{uri.var.BaseURI}/{uri.var.portalid}/{uri.var.Projects}/{uri.var.projectid}/{uri.var.Tasks}/?name={uri.var.task_name}&amp;person_responsible={uri.var.owner_id}&amp;description={uri.var.description}&amp;priority={uri.var.priority}&amp;"/>
                        </endpoint>
                    </call>
                    <property description="ResponseMessage" expression="json-eval($.error.message)" name="ResponseMessage" scope="default" type="STRING"/>
                    <log level="custom">
                        <property expression="json-eval($.)" name="==== Task Creation Response ===="/>
                        <property expression="get-property('axis2','HTTP_SC')" name="==== HTTP Status Code ===="/>
                    </log>
                    
                    <log>
                        <property name="Process Status" value="=== Completed ==="/>
                    </log>
                    <respond/>
                </then>
                <else>
                    <log>
                        <property name="Response" value="=== Task Name Missing ==="/>
                    </log>
                    <respond/>
                </else>
            </filter>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)