我需要將xml文件發佈到我的供應商的API。 他給了我一個鏈接,accesskey,secretkey,並告訴我推送xml文件。 他也給了我一個示例代碼來發布json中的XML文件。請在下面找到它。在C#中發佈一個xml文件到API .net
{
"id": "22307a79-89dc-914e-5cf1-098f992e5054",
"name": "Sample Request",
"description": "",
"order": [
"36f699c6-0765-3e31-fdf8-863a3c3d508c"
],
"folders": [],
"timestamp": 1497005641974,
"owner": "1189835",
"public": false,
"requests": [
{
"id": "36f699c6-0765-3e31-fdf8-863a3c3d508c",
"headers": "accessKey: 1057550\nsecretKey: t3stH11p7550\n",
"headerData": [
{
"key": "accessKey",
"value": "1057550",
"description": "",
"enabled": true
},
{
"key": "secretKey",
"value": "dummy7550",
"description": "",
"enabled": true
}
],
"url": "https://feeds.vendor.com/API.php/Job/postHttpJob",
"queryParams": [],
"preRequestScript": null,
"pathVariables": {},
"pathVariableData": [],
"method": "POST",
"data": [
{
"key": "content",
"value": "<?xml version=\"1.0\"?>\n<JobPositionPostings>\n <JobPositionPosting>\n <JobAction>ADD</JobAction>\n <JobType>p</JobType>\n <JobPositionPostingID>27</JobPositionPostingID>\n <SummaryText>Desired Candidate Profile Summary Text - Required Competencies/Skills/Leadership E-mail\n </SummaryText>\n <JobExperience>\n <MinimumExperience>2</MinimumExperience>\n <MaximumExperience>4</MaximumExperience>\n </JobExperience>\n <JobQualifications>\n <UGQualifications />\n <UGSpecializations />\n <PGQualifications />\n <PGSpecializations />\n </JobQualifications>\n </JobPositionRequirements>\n </JobPositionInformation>\n <HowToApply>\n <ApplicationMethods>\n <ByWeb>\n <URL>\n </URL>\n <ApplyIntegration>1</ApplyIntegration>\n </ByWeb>\n </ApplicationMethods>\n </HowToApply>\n </JobPositionPosting>\n</JobPositionPostings>\n",
"type": "text",
"enabled": true
},
{
"key": "",
"value": "",
"description": "",
"type": "text",
"enabled": true
}
],
"dataMode": "params",
"version": 2,
"tests": null,
"currentHelper": "normal",
"helperAttributes": {},
"time": 1501909208689,
"name": "Sample Request",
"description": "Sample Request with sample XML",
"collectionId": "22307a79-89dc-914e-5cf1-098f992e5054",
"responses": []
}
]
}
我在C#.NET的工作,我如何將它轉換爲C#.NET或有人可以讓我知道我如何使用C#.NET推動XML文件到我的供應商的API。
在此先感謝。
然而你的供應商告訴你這樣做。檢查他們的API文檔或聯繫他們的支持 – musefan