• Varun Sharma 177
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi All,

I was given this sample JSON by our partner and I am trying to write a REST Web service to ingest it but I can't seem to get it to work. I am testing it in Workbench and am getting this error:

Unexpected parameter encountered during deserialization: orderNumber at [line:2, column:17

Here is the Apex Class:
 
@RestResource(urlMapping='/DPS_Response/')
global with sharing class DPSResposnse
{
    global class AllParties
    {
        global String partyId;
        global String decision;
    }    
    
    @HttpPost
    global static String updateDPSData    (String orderNumber, AllParties[] parties)
    {
       return 'test';
    }
}

And here is the sample JSON:
{
    "orderNumber":"000042289",
    "parties":
       [
      {
        "partyId": "12345",
        "decision":    "D"    
      },
      {
        "partyId": "09876",
        "decision":    "P"        
      }

       ]
}