Add value to JSON request node. Function accepts any kind of variable or a record, that can be added to a node with Type = Table
.
For a Simple Array
or Complex Array
node, this function can be called repeatedly to add more values.
Text
- Specifies the path to JSON node in XPath syntax. E.g. write /
for a root node, /customer/phones
for a phones node in customer object.Variant
- Specifies the value, that will be added to a JSON node.Text
– Specifies the filename, if the _ValueVariant parameter contains file InStream
.//Add a simple value to id node
APIScriptRWU.ADD_VALUE('/id',1);
//Add a record value to the root table node
Customer.GET('10000');
APIScriptRWU.ADD_VALUE('/',Customer);
//Add more values to an array node
APIScriptRWU.ADD_VALUE('/phones','123456789');
APIScriptRWU.ADD_VALUE('/phones','999999999');
//Force user to select a file and add the file contents to file node
var
FileManagement: Codeunit "File Management";
TempBlob: Codeunit "Temp Blob";
FileInStream: InStream;
AllFilesFilterTxt: Label '*.*', Locked = true;
AllFilesDescriptionTxt: Label 'All Files (*.*)|*.*', Comment = '{Split=r''\|''}{Locked=s''1''}';
FileName: Text;
FileName := FileManagement.BLOBImportWithFilter(TempBlob, 'Choose File', 'Name', AllFilesDescriptionTxt, AllFilesFilterTxt);
TempBlob.CreateInStream(FileInStream);
ApiScriptRWU.ADD_VALUE('/file', FileInStream, FileName);