0

I am trying to clone Lightning Aura Bundle using Tooling API. First I executed the GET from REST Explorer using Workbench by passing the component Id. And then I used the Raw Response to hit the POST API.

Below is the Response from GET Call:

> {   "attributes" : {
    "type" : "AuraDefinitionBundle",
    "url" : "/services/data/v41.0/tooling/sobjects/AuraDefinitionBundle/0Ab6F000000AoYrSAK" },   "Id" : "0Ab6F000000AoYrSAK",   "IsDeleted" : false,   "DeveloperName" : "CurrencyNameToValue",   "Language" : "en_US",   "MasterLabel" : "CurrencyNameToValue",   "NamespacePrefix" : null,   "ManageableState" : "unmanaged",   "CreatedDate" : "2018-10-14T18:11:50.000+0000",   "CreatedById" : "0056F000009V6XNQA0",   "LastModifiedDate" : "2018-10-15T18:49:59.000+0000",   "LastModifiedById" : "0056F000009V6XNQA0",   "SystemModstamp" : "2018-10-15T18:49:59.000+0000",   "ApiVersion" : 44.0,   "Description" : "A Lightning Component Bundle",   "Metadata" : {
    "apiVersion" : 44.0,
    "controllerContent" : {
      "asByteArray" : "KHsKICAgIGluaXQ6IGZ1bmN0aW9uKGNvbXBvbmVudCwgZXZlbnQsIGhlbHBlcikgewogICAgICAgIGhlbHBlci5mZXRjaEN1cnJlbmNpZXMoY29tcG9uZW50LCBldmVudCwgaGVscGVyKTsKICAgIH0sCiAgICAKICAgIGdldFVwZGF0ZWRDdXJyZW5jeVJhdGU6IGZ1bmN0aW9uKGNvbXBvbmVudCwgZXZlbnQsIGhlbHBlcikgewogICAgICAgIGhlbHBlci5nZXRVcGRhdGVkQ3VycmVuY2llcyhjb21wb25lbnQsIGV2ZW50LCBoZWxwZXIpOwogICAgfSwK",
      "inputStream" : { },
      "length" : 255,
      "maxToKeep" : 256
    },
    "description" : "A Lightning Component Bundle",
    "designContent" : null,
    "documentationContent" : null,
    "helperContent" : {
      "asByteArray" : "KHsKICAgIGZldGNoQ3VycmVuY2llczogZnVuY3Rpb24gKGNvbXBvbmVudCwgZXZlbnQsIGhlbHBlcil7CiAgICAgICAgdmFyIGFjdGlvbiA9IGNvbXBvbmVudC5nZXQoJ2MuZmV0Y2hDdXJyZW5jaWVzJyk7CiAgICAgICAgYWN0aW9uLnNldENhbGxiYWNrKHRoaXMsIGZ1bmN0aW9uKHJlc3BvbnNlKSB7CiAgICAgICAgICAgIHZhciBzdGF0ZSA9IHJlc3BvbnNlLmdldFN0YXRlKCk7CiAgICAgICAgICAgIHZhciByZXN1bHQgPSByZXNwb25zZS5nZXRS",
      "inputStream" : { },
      "length" : 255,
      "maxToKeep" : 256
    },
    "markup" : {
      "asByteArray" : "PGF1cmE6Y29tcG9uZW50IGltcGxlbWVudHM9ImZvcmNlOmFwcEhvc3RhYmxlLGZsZXhpcGFnZTphdmFpbGFibGVGb3JBbGxQYWdlVHlwZXMsZmxleGlwYWdlOmF2YWlsYWJsZUZvclJlY29yZEhvbWUsZm9yY2U6aGFzUmVjb3JkSWQiIGFjY2Vzcz0iZ2xvYmFsIiBjb250cm9sbGVyPSJ7IUlEOkBAQHNmZGM9MDFwNkYwMDAwMExyWm84PXNmZGNAQEB9Ij4KICAgIAogICAgPGF1cmE6YXR0cmlidXRlIG5hbWU9Imxpc3RPcHRpb25zIiB0eXBlPSJMaXN0",
      "inputStream" : { },
      "length" : 255,
      "maxToKeep" : 256
    },
    "modelContent" : null,
    "packageVersions" : [ ],
    "rendererContent" : null,
    "styleContent" : {
      "asByteArray" : "LlRISVMudGFibGVIaWRlewogICAgZGlzcGxheTogbm9uZTsKfQoKLlRISVMuaGlkZURpdnsKICAgIGRpc3BsYXk6IG5vbmU7Cn0KCi5USElTLndyYXBwZXIgewogICAgdGV4dC1hbGlnbjogY2VudGVyOwogICAgcGFkZGluZy1ib3R0b206IDIwcHg7CiAgICBwYWRkaW5nLXRvcDogMjBweDsKICAgIHBhZGRpbmctbGVmdDogMTBweDsKfQ==",
      "inputStream" : { },
      "length" : 190,
      "maxToKeep" : 191
    },
    "svgcontent" : null,
    "testsuiteContent" : null,
    "type" : "Component",
    "urls" : null   
    },   
    "FullName" : "CurrencyNameToValue" 
  }

Now I am calling the POST method using the above response.

Request for POST Call:

{
  "DeveloperName" : "CurrencyNameToValue",
  "MasterLabel" : "CurrencyNameToValue",
  "ApiVersion" : 44.0,
  "Description" : "A Lightning Component Bundle",
  "Metadata" : {
    "apiVersion" : 44.0,
    "controllerContent" : {
      "asByteArray" : "KHsKICAgIGluaXQ6IGZ1bmN0aW9uKGNvbXBvbmVudCwgZXZlbnQsIGhlbHBlcikgewogICAgICAgIGhlbHBlci5mZXRjaEN1cnJlbmNpZXMoY29tcG9uZW50LCBldmVudCwgaGVscGVyKTsKICAgIH0sCiAgICAKICAgIGdldFVwZGF0ZWRDdXJyZW5jeVJhdGU6IGZ1bmN0aW9uKGNvbXBvbmVudCwgZXZlbnQsIGhlbHBlcikgewogICAgICAgIGhlbHBlci5nZXRVcGRhdGVkQ3VycmVuY2llcyhjb21wb25lbnQsIGV2ZW50LCBoZWxwZXIpOwogICAgfSwK",
      "inputStream" : { },
      "length" : 255,
      "maxToKeep" : 256
    },
    "description" : "A Lightning Component Bundle",
    "designContent" : null,
    "documentationContent" : null,
    "helperContent" : {
      "asByteArray" : "KHsKICAgIGZldGNoQ3VycmVuY2llczogZnVuY3Rpb24gKGNvbXBvbmVudCwgZXZlbnQsIGhlbHBlcil7CiAgICAgICAgdmFyIGFjdGlvbiA9IGNvbXBvbmVudC5nZXQoJ2MuZmV0Y2hDdXJyZW5jaWVzJyk7CiAgICAgICAgYWN0aW9uLnNldENhbGxiYWNrKHRoaXMsIGZ1bmN0aW9uKHJlc3BvbnNlKSB7CiAgICAgICAgICAgIHZhciBzdGF0ZSA9IHJlc3BvbnNlLmdldFN0YXRlKCk7CiAgICAgICAgICAgIHZhciByZXN1bHQgPSByZXNwb25zZS5nZXRS",
      "inputStream" : { },
      "length" : 255,
      "maxToKeep" : 256
    },
    "markup" : {
      "asByteArray" : "PGF1cmE6Y29tcG9uZW50IGltcGxlbWVudHM9ImZvcmNlOmFwcEhvc3RhYmxlLGZsZXhpcGFnZTphdmFpbGFibGVGb3JBbGxQYWdlVHlwZXMsZmxleGlwYWdlOmF2YWlsYWJsZUZvclJlY29yZEhvbWUsZm9yY2U6aGFzUmVjb3JkSWQiIGFjY2Vzcz0iZ2xvYmFsIiBjb250cm9sbGVyPSJ7IUlEOkBAQHNmZGM9MDFwNkYwMDAwMExyWm84PXNmZGNAQEB9Ij4KICAgIAogICAgPGF1cmE6YXR0cmlidXRlIG5hbWU9Imxpc3RPcHRpb25zIiB0eXBlPSJMaXN0",
      "inputStream" : { },
      "length" : 255,
      "maxToKeep" : 256
    },
    "modelContent" : null,
    "packageVersions" : [ ],
    "rendererContent" : null,
    "styleContent" : {
      "asByteArray" : "LlRISVMudGFibGVIaWRlewogICAgZGlzcGxheTogbm9uZTsKfQoKLlRISVMuaGlkZURpdnsKICAgIGRpc3BsYXk6IG5vbmU7Cn0KCi5USElTLndyYXBwZXIgewogICAgdGV4dC1hbGlnbjogY2VudGVyOwogICAgcGFkZGluZy1ib3R0b206IDIwcHg7CiAgICBwYWRkaW5nLXRvcDogMjBweDsKICAgIHBhZGRpbmctbGVmdDogMTBweDsKfQ==",
      "inputStream" : { },
      "length" : 190,
      "maxToKeep" : 191
    },
    "svgcontent" : null,
    "testsuiteContent" : null,
    "type" : "Component",
    "urls" : null
},
  "FullName" : "CurrencyNameToValue"
}

Getting below error while doing the above steps:

JSON_PARSER_ERROR message: Cannot deserialize instance of complexvalue from VALUE_STRING value or request may be missing a required field at [line:9, column:24] errorCode: JSON_PARSER_ERROR

Can anyone please suggest me how to execute POST call in this scenario.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.