0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Apex REST callouts unit

Last updated at Posted at 2022-04-15

これも良く目にする質問。

Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById'

これまではこのエラーが出たら

回避するためには文字列結合を使う必要がある。
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/'+id);

Apex REST コールアウトのtrailチェックがバグってる件

だったんですが、最近はこれではないようです。

前からきになっていたのですが、Integer型をそのまま使っていること。
どうも、チェックロジックも変更してちゃんとString型にしないといけないよういなったのかもしれませんね。

request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/' + String.valueOf(id));

Getting error on Apex REST Callout Challenge

以上でも解決しない場合
リモートサイト「https://th-apex-http-callout.herokuapp.com」を追加するとエラーが解決し、チャレンジに合格することができました。

Go to setup->Remote Site Setting->New. Then enter the detail and https://th-apex-http-callout.herokuapp.com/animals/id this website in it. Save

Cannot pass through the challenge in Apex REST Callouts unit

上記を試したのにエラー、何で解決したかは全くわからん。
Following error occurs for Apex REST callouts. even though it does 100%

No Remote Site named ‘animals_http’ was found with the correct Name, URL, and Description

リモートサイト名を間違っていたというオチでした。

just Add both Remote site settings in your org in the previous module we perform this task https://trailhead.salesforce.com/content/learn/modules/apex_integration_services/apex_integration_callouts

  • Add a Remote Site

    • Name: animals_http
    • Remote site URL: th-apex-http-callout.herokuapp.com
    • Description: Trailhead animal service: HTTP
  • Add a Remote Site

    • Name: animals_soap
    • Remote site URL: th-apex-soap-service.herokuapp.com
    • Description: Trailhead animal service: SOAP

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000HECRvSAP

リモートサイトのURLが2つ?

No Remote Site named ‘animals_http’ was found with the correct Name, URL, and Description.

I found the issue. For some reason , you have to have both animals_http , animals_soap remote site settings created before checking REST excercise. Adding both of them fixed the issue.

エラー

image.png

既知の問題にあがっていますね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?