Salesforce Invoking Apex REST Http GET Callout

Поделиться
HTML-код
  • Опубликовано: 4 дек 2024

Комментарии • 18

  • @orlybriceno
    @orlybriceno 2 года назад

    Thanks so much for the videos they're super helpful! Chris, are you planning to do a video for HttpCalloutMock ?

    • @ChrisMarquez
      @ChrisMarquez  2 года назад +1

      Hello Orlando, thanks for watching. Sure, I'll add that video topic to my todo list. I'm currently taking a break but I'll reply to your comment once that video is uploaded. (In 1-2 weeks)

    • @orlybriceno
      @orlybriceno 2 года назад

      @@ChrisMarquez that'd be awesome : )

    • @ChrisMarquez
      @ChrisMarquez  2 года назад

      @@orlybriceno A couple of months late but here you go 😅: ruclips.net/video/uD8G4y1avBw/видео.html

  • @RogerFedora
    @RogerFedora Год назад

    Hey Chris thanks so much this is really good and really interesting. I wonder if you can do any more explanation of why in the Trailhead module they chose to deserialise the response 'untyped' but you chose to just deserialise it?
    Also why did they cast the response into a Map and then cast the animal names into a List afterwards? (presumably they could have just cast the response into a list)
    Also I still don't get why the animal names are clearly Strings but they were cast into the Object datatype? Sorry for the all the questions, I'm still new to this.

    • @ChrisMarquez
      @ChrisMarquez  Год назад

      Hello Roger, I'll probably make a video further explaining this at some point but for now, hopefully this helps:
      - The JSON structure follows a key/value convention and Maps are a good fit for that regardless of what the response might be. In this case, the response JSON has a key of animals and a value of a list of strings. You'd need to deserialize the JSON into that structure first, I don't think you would be able to deserialize and cast directly to a list.
      - I chose to deserialize to show how to use an apex class to represent the JSON. This is useful when you already know the response JSON structure and want to have the structure defined in your code. deserializeUntyped is useful if the JSON is not known at compile time or perhaps doesn't match the Apex class representation you already defined. Since the JSON isn't known at compile time (you know it's a string because you can see the JSON), it's stored as Objects.

    • @RogerFedora
      @RogerFedora Год назад

      @@ChrisMarquez Wow that's super-helpful! I've been making notes on the Trailhead unit, your video and a couple of other things about making callouts in Apex and I actually made a successful callout using a Map then getting that into a list and iterating through the list with system.debug but I'm going to add what you've written to my notes. I'm really starting to get there. Thank you so much for taking the time to reply. Best wishes from Matt from London, UK.

    • @ChrisMarquez
      @ChrisMarquez  Год назад

      That's good to hear Matt! Let me know if there are any other topics you'd like to see videos on.

  • @TK-vt3ep
    @TK-vt3ep 2 года назад

    Hello Chris,
    How to read all the pages in GET JSON response. Like say , GET call for end points returns multipage records pages url and i need to read all the pages to get specific parameter of JSON response. How shall we do that ?

  • @julian_pp
    @julian_pp 2 года назад

    thank you! Which one is the video that follows this one?

    • @ChrisMarquez
      @ChrisMarquez  2 года назад

      No problem!
      I don't have a playlist for Callouts but here's a video on a POST Callout: ruclips.net/video/nDGZYRKbskU/видео.html and here's one on testing callouts: ruclips.net/video/uD8G4y1avBw/видео.html
      I do have a playlist on Web Services: ruclips.net/p/PLL3Iw8hs1Qkq5-feSfNvYUytNe6pl1OEV

  • @vinzpica2205
    @vinzpica2205 2 года назад

    Interesting video. I have a question! If I want to call this request by action's bot, how can I do?

    • @ChrisMarquez
      @ChrisMarquez  2 года назад +1

      Hey Vinz pica, by bot do you mean this? developer.salesforce.com/docs/atlas.en-us.bot_cookbook.meta/bot_cookbook/bot_cookbook_call_apex_action.htm

    • @vinzpica2205
      @vinzpica2205 2 года назад

      @@ChrisMarquez yes

    • @ChrisMarquez
      @ChrisMarquez  2 года назад

      Here's a SF stack exchange post that covers it: salesforce.stackexchange.com/questions/241741/i-am-trying-to-callout-http-requestapi-from-einstein-chatbot-is-this-possible
      I'll make a video on this soon.

    • @ChrisMarquez
      @ChrisMarquez  2 года назад

      Here you go: ruclips.net/video/8i_fLOCo6Uk/видео.html

  • @alvaromerodio928
    @alvaromerodio928 2 года назад

    Hi Chris,
    I want to make a multiple @HttpGet inside the same class but a single Apex class annotated with @RestResource can't have multiple methods annotated with the same HTTP request method.
    In that case, with the Http class, can I solved this problem?
    Thanks.

    • @ChrisMarquez
      @ChrisMarquez  2 года назад

      Hello Alvaro, you can try doing something like this: salesforce.stackexchange.com/questions/358382/is-it-possible-to-have-multiple-post-calls-in-the-same-apex-rest-class
      I'll make a video on this in a week or so.