第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

通過(guò) HttpClient 訪問(wèn) Design Automation API v3 時(shí)出現(xiàn) 404

通過(guò) HttpClient 訪問(wèn) Design Automation API v3 時(shí)出現(xiàn) 404

C#
森林海 2023-05-13 16:10:52
在 Postman 中運(yùn)行對(duì) Design Automation API 的調(diào)用工作得很好,但是當(dāng)我嘗試使用 HttpClient 在 C# 中進(jìn)行相同的調(diào)用時(shí),它們失敗并顯示 404,這似乎實(shí)際上隱藏了身份驗(yàn)證錯(cuò)誤:{     "developerMessage":"The requested resource does not exist.",    "userMessage":"",    "errorCode":"ERR-002",    "more info":"http://developer.api.autodesk.com/documentation/v1/errors/err-002"}該鏈接導(dǎo)致身份驗(yàn)證錯(cuò)誤:<Error>    <Code>AccessDenied</Code>    <Message>Access Denied</Message>    <RequestId>1F52E60A45AEF429</RequestId>    <HostId>        [ Some base64 ]    </HostId></Error>我正在關(guān)注如何使用 HttpClient 的示例,但我可能遺漏了一些東西。我成功獲取了訪問(wèn)令牌,運(yùn)行var client = new HttpClient{    BaseAddress = new Uri("https://developer.api.autodesk.com/da/us-east")};client.DefaultRequestHeaders.Authorization =            new System.Net.Http.Headers.AuthenticationHeaderValue(TokenType, AccessToken);然后var result = await client.GetAsync("/v3/forgeapps/me");而上面的json就是結(jié)果的內(nèi)容。我在 Postman 中使用相同的訪問(wèn)令牌并且它有效。
查看完整描述

1 回答

?
qq_花開(kāi)花謝_0

TA貢獻(xiàn)1835條經(jīng)驗(yàn) 獲得超7個(gè)贊

我會(huì)在 HttpRequestMessage 中包含端點(diǎn)、標(biāo)頭和 httpmethod。然后發(fā)送并賦值給HttpResponseMessage。


var client = new HttpClient

{

    BaseAddress = new Uri("https://developer.api.autodesk.com/da/us-east/")

};


//throw the endpoint and HttpMethod here. Could also be HttpMethod.Post/Put/Delete (for your future reference)

var request = new HttpRequestMessage(HttpMethod.Get, "v3/forgeapps/me");


//also maybe try throwing the headers in with the request instead of the client

request.Headers.Add(TokenType, AccessToken);


// send the request, assign to response

HttpResponseMessage response = await client.SendAsync(request);


//then, we can grab the data through the Content

string result = await response.Content.ReadAsStringAsync();


查看完整回答
反對(duì) 回復(fù) 2023-05-13
  • 1 回答
  • 0 關(guān)注
  • 147 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)