Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate object with the name a property set to the contents of variable
    primarykey
    data
    text
    <p>I am using the following code snippet to create a class <code>payload</code>:</p> <pre><code>function setPointer(parent, attribute, children) { var url = 'https://api.xzy.com/1/classes/' + parent; var pointToObjects = []; for (var i = 0; i &lt; children.length; i++) { var pointToObject = { "__type":"Pointer", "className": childrenClass, "objectId":children[i] }; pointToObjects.push(pointToObject); } var object = { attribute:{ "__op":"AddRelation", "objects":pointToObjects } }; var payload = JSON.stringify(object); var payload = { attribute:{ "__op":"AddRelation", "objects":children } }; var options = { 'method': 'post', 'contentType':'application/json', 'headers': makeHeaders(), 'payload': payload, 'muteHttpExceptions':false }; var jsonResponse = UrlFetchApp.fetch(url, options); Logger.log(jsonResponse.getResponseCode() + ': ' + jsonResponse); } </code></pre> <p>How can I set the <code>attribute</code> and <code>children</code> properties of the <code>payload</code> object to the contents of the parameters <code>attribute</code> (e.g. "period") and <code>children</code> (e.g. "hgssgs", "eejss")? </p> <p>I would like to create a HTTP request like the following:</p> <pre><code>curl -X PUT \ -H "X-Parse-Application-Id: yyy" \ -H "X-Parse-REST-API-Key: xxxx" \ -H "Content-Type: application/json" \ -d '{"opponents":{"__op":"AddRelation","objects":[{"__type":"Pointer","className":"Player","objectId":"Vx4nudeWn"}]}}' \ https://api.parse.com/1/classes/GameScore/Ed1nuqPvcm </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload