• Mike Richmond
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
as part of a scratch org setup script, i'm trying to create and/or modify records through the tooling API - things like remote site settings, outbound messages, etc. these objects all have required "Metadata" fields.

using a remote site setting as an example: if i do this through the restforce gem for ruby, it works fine. i can execute:
resp = sf.create!('RemoteProxy', Metadata: {disableProtocolSecurity: false, isActive: true, url: 'https://www.my-site.com', urls: nil, description: nil}, FullName: 'test_remote_site')
and it creates the site correctly. if i try to do this through the CLI, though:
sfdx force:data:record:create -t -s RemoteProxy -v "FullName='test_remote_site' Metadata='{"disableProtocolSecurity":false,"isActive":true,"url":"https://www.my-site.com","urls":null,"description":null}'"
it fails with error: "Cannot deserialize instance of complexvalue from null value null or request may be missing a required field." I get the same result if I serialize the JSON. The data I'm providing is the same, so the problem isn't with the data or the API itself; it seems like either I'm not using the correct format, or something in the CLI is not serializing the JSON and/or building the request correctly.

Anyone else encounter a similar problem or find a workaround? In what format am I supposed to provide the metadata for a request like this?