Skip to main content

Hi Everybody

I have this JSON code but I have no clue how to write it as plsqlap_Document_API.

If I run a test i routing address the code below works.

Does anybody now how to write this the best way. 

my goal is also to stay in the same method with the respond because I need to return the result to the client. 

{

  "customer_id": "XXXXXXXXX",

  "leg_requests": [

    {

      "credit_currency": "SEK",

      "debit_currency": "USD",

      "tenor": "SPOT",

      "amount": {

        "amount": 200,

        "currency": "USD"

      }

    }

  ]

}

when I do it look something like this. and it has many more layers.

  request_ := plsqlap_Document_API.New_Document('SebFxOut');

   head_array_ := Plsqlap_Document_API.Add_Array(request_, 'SebFxOut');
   head_id_    := Plsqlap_Document_API.Add_Document(request_, 'SebFxOut', head_array_);

   Plsqlap_Document_API.Add_Attribute(request_, 'customer_id',             'XXXXXX', head_id_);

   line_array_   := Plsqlap_Document_API.Add_Array(request_, 'leg_requests', head_id_);
   line_id_ := Plsqlap_Document_API.Add_Document(request_, 'leg_requests', line_array_);   
   Plsqlap_Document_API.Add_Attribute(request_,'credit_currency',            credit_currency_, line_id_);
   Plsqlap_Document_API.Add_Attribute(request_,'tenor',                      'SPOT', line_id_);
   
   amount_array_   := Plsqlap_Document_API.Add_Array(request_, 'amount', line_id_);
   line_id_ := Plsqlap_Document_API.Add_Document(request_, 'amount', amount_array_);   
   Plsqlap_Document_API.Add_Attribute(request_,'amount',                     amount_, line_id_);
   Plsqlap_Document_API.Add_Attribute(request_,'currency',                   debit_currency_, line_id_);

   --Transform the IFS_XML body to json
   Plsqlap_Document_API.To_Json(json_, request_);

 

Is this the best way to stay in the same procdure?

   Plsql_Rest_Sender_API.Call_Rest_Endpoint3(
   rest_service_  => NULL, 
   xml_           => json_, 
   http_method_   => 'POST',
   sender_        => 'FX1',
   receiver_      => 'FX2');

Hi Peter,

 

Do you still need a help here?

 

Thanks & Regards

Mohit.


Hi, thanks for the answer.

I do not need hale anymore. :-)

We have solved.

I should have closed the question but I do not know how.


Hi, thanks for the answer.

I do not need hale anymore. :-)

We have solved.

I should have closed the question but I do not know how.

Great to hear. If you could, it would be very useful if you could share your solution, and then you can mark that as the “Best Answer”.