TransWikia.com

Inserting records into DatedConversionRate from Apex with the REST API fails with an odd response

Salesforce Asked by SF1Dev on February 22, 2021

With advanced currency management enabled, I’m inserting new dated currency data with a form post to this URL: System.URL.getSalesforceBaseUrl().toExternalForm() + '/services/data/v51.0/composite/tree/DatedConversionRate/'

Here’s the body of the message:

 {
    "records": [
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refAUD"
          },
          "IsoCode": "AUD",
          "ConversionRate": "1.31458",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refCAD"
          },
          "IsoCode": "CAD",
          "ConversionRate": "1.27856",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refCHF"
          },
          "IsoCode": "CHF",
          "ConversionRate": "0.897860",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refDKK"
          },
          "IsoCode": "DKK",
          "ConversionRate": "6.17871",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refEUR"
          },
          "IsoCode": "EUR",
          "ConversionRate": "0.830744",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refGBP"
          },
          "IsoCode": "GBP",
          "ConversionRate": "0.732043",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refMXN"
          },
          "IsoCode": "MXN",
          "ConversionRate": "20.1393",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refNOK"
          },
          "IsoCode": "NOK",
          "ConversionRate": "8.60171",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refSEK"
          },
          "IsoCode": "SEK",
          "ConversionRate": "8.39861",
          "StartDate": "2021-2-2"
       },
       {
          "attributes":
          {
             "type": "DatedConversionRate",
             "referenceId": "refZAR"
          },
          "IsoCode": "ZAR",
          "ConversionRate": "14.9536",
          "StartDate": "2021-2-2"
       }
    ]
 }

This results in the following response: [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]

I’m executing the code anonymously for testing purposes. What could be causing the error?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP