Salesforce Apex REST Web Services Serialize/Deserialize JSON with Apex Wrapper Class (POST Request)

Поділитися
Вставка
  • Опубліковано 2 лис 2024

КОМЕНТАРІ • 27

  • @tejassontakke8382
    @tejassontakke8382 2 роки тому +1

    Thanks for the simple explanation. Please do make more REST Web Services videos under the same series.

    • @ChrisMarquez
      @ChrisMarquez  2 роки тому +1

      Thanks for watching. Sure, is there anything specific you want to see with REST Web Services?

    • @tejassontakke8382
      @tejassontakke8382 2 роки тому

      @@ChrisMarquez Thanks for your response. Calling other api's and handling response with custom exception handling would be great to know if possible. Thanks.

  • @nofluffagain
    @nofluffagain 2 роки тому +1

    Brilliant video. Deeply helpful thanks!

  • @user-sr2sj3et8u
    @user-sr2sj3et8u Рік тому

    Hi Chris, brilliant video very useful to me..a big THANKS. Liked & subscribed

    • @ChrisMarquez
      @ChrisMarquez  Рік тому

      Much appreciated! Let me know if there are any topics you would like to see me make videos on.

  • @JCbeatProductions
    @JCbeatProductions 2 роки тому

    Man this is SO helpful for me. Thank you! Liked and subbed

    • @ChrisMarquez
      @ChrisMarquez  2 роки тому

      Much appreciated! Let me know if there are any topics you would like me to cover.

  • @roysan896
    @roysan896 Рік тому

    Hi Chris i really admire your content these are realistic example.. just a question here can't we need to create the connected app here in salesforce? or you missed this part in the video ? please help....

    • @ChrisMarquez
      @ChrisMarquez  Рік тому

      Hey Santanu, this video is part of my Salesforce Web Service playlist that can be found here: ua-cam.com/play/PLL3Iw8hs1Qkq5-feSfNvYUytNe6pl1OEV.html
      The first video covers connected apps. Let me know if you have any other questions.

  • @JOSEMARTINEZ-dq8zb
    @JOSEMARTINEZ-dq8zb 2 роки тому

    Thanks Christ!

  • @anilpoudel5974
    @anilpoudel5974 2 роки тому

    Sir suppose I have AL3 file in my desktop and I need to convert that format and read using third party API how I will upload file in that API and retrieve that file in particular format without the use of any object just normally passing desktop file.

  • @RVAraghav
    @RVAraghav 2 роки тому

    Hi Chris, can you also post a video on making a callout and sending a POST Request? For example, how do you pass parameters to a JSON string and send it to an external system in apex?

    • @ChrisMarquez
      @ChrisMarquez  2 роки тому

      Hey Kolumam, sure no problem. I'll post a video on this in a few days.

    • @ChrisMarquez
      @ChrisMarquez  2 роки тому

      Here you go: ua-cam.com/video/nDGZYRKbskU/v-deo.html

    • @RVAraghav
      @RVAraghav 2 роки тому

      @@ChrisMarquez Thank you for the video. Let me watch it and will provide you my feedback.

  • @JCbeatProductions
    @JCbeatProductions 2 роки тому

    How would you handle creating Records on 4 different objects like: Contact , Account, Opportunity, Opportunity Line item all from a single JSON Post

    • @ChrisMarquez
      @ChrisMarquez  2 роки тому +1

      That would depend on the actual requirements such as should the web service accept multiple records of each or just one, handling of only partial data provided, should this data be considered new or do you have to check to see if it might already exist in the org, does the external system provide an external id for each record, etc.
      Generally speaking, for the json representation part, you could create inner classes to represent each of the records and then instantiate a list for each at the outer class level. The opportunity class could contain a list of opportunity line items objects.
      Hopefully this makes sense. I'll make a video that goes more into depth soon.

  • @prateekmishra2755
    @prateekmishra2755 2 роки тому +1

    How to update a record using apex rest web service and postman

    • @ChrisMarquez
      @ChrisMarquez  2 роки тому +1

      Hello Prateek. I'll make a video on this topic soon but here is a quick explanation of what you can do:
      - To update a record, create a new method in your web service class with the "@HttpPatch" annotation. This annotation is typically used to update existing records. This method will need to have logic to identify if the request received is valid, contains a unique identifier that you can use to associate with a record in the system, and contains key/values that are valid. This method should utilize the update DML statement.
      - To update a record using postman, create a PATCH request and include the JSON with key/values that you want changed.
      Hope this helps.

    • @prateekmishra2755
      @prateekmishra2755 2 роки тому

      @@ChrisMarquez thank you for the reply Chris 👍👍

    • @ChrisMarquez
      @ChrisMarquez  2 роки тому +1

      @@prateekmishra2755 here is a link to my new video that explains the solution: ua-cam.com/video/DXXukMafYYU/v-deo.html

  • @rohandanwade7564
    @rohandanwade7564 11 днів тому

    10:47 Note

  • @ChrisMarquez
    @ChrisMarquez  3 роки тому +1

    I made a mistake for the return type of the "createSupply" method.
    It is not necessary to serialize the response since the system automatically does that for us. The correct thing to do is to set the return type of createSupply to SupplyJSONWrapper.response and simply return that without using the "JSON.serialize" method.
    Example:
    @HttpPost
    global static SupplyJSONWrapper.response createSupply(){
    ...
    SupplyJSONWrapper.response response = new SupplyJSONWrapper.response();
    response.success = success;
    response.message = message;
    return response;
    }
    Doing it this way will ensure that the response is not serialized twice.
    I'll go over this mistake in my next video.