title: POST request to score using Cloud Model
body: <p>I am using IBM Bluemix and the new SPSS Predictive Modelling service. I want to score some data using a model that I deployed in the cloud. In the documentation I have the following Request example:</p>
  
  <pre><code> Content-Type: application/json;charset=UTF-8
      Parameters:
          Path parameters:
              contextId: the identifier of the deployed model to be used to process this score request
          Query Parameters:
              accesskey: access_key from env.VCAP_SERVICES
          Body: the input data, json string, eg.
              {
                  "tablename":"DRUG1n.sav", 
                  "header":["Age", "Sex", "BP", "Cholesterol", "Na", "K", "Drug"], 
                  "data":[[43.0, "M", "LOW", "NORMAL", 0.526102, 0.027164, "drugY"]]
              }  
  </code></pre>
  
  <p>I want to do the request using R and the httr package. I wrote the following code:</p>
  
  <pre><code>library(httr)
  #Score using a deployed predictive model
  host = "https://ibmpmsrvus1.pmservice.ibmcloud.com:8443/pm/v1/score/"
  access_key = "vvZ0DIc1d/oAzguseZS/cDf98us5bgi41pau9YEOtu81pRuVE1E2ND6v469pmmerEC2a6an71wxIdhb3gIZ5P7jnBaXJcLpJ+Ta+djR1Uu20nSZ+Rw9rXoOuXOuFsYgUnnipl9lQKr1S2ukXJrA2wA=="
  contextId="drug"
  url &lt;- paste(host,contextId,"?accesskey=",access_key, sep = "")
  data&lt;-toJSON(list("tablename"= unbox("scoreInput"),
                "header" = c("Age", "Sex", "BP", "Cholesterol", "Na", "K","Drug"),
                "data" = c(unbox(43.0),"M","LOW","NORMAL",0.526102,0.027164,"drugY")
  </code></pre>
  
  <p>))
      r&lt;-POST(url,body = data, encode = 'json')
      r </p>
  
  <p>The json generated using the <code>toJSON</code> is a bit different:</p>
  
  <pre><code>{"tablename":"scoreInput","header":["Age","Sex","BP","Cholesterol","Na","K","Drug"],
  "data":["43","M","LOW","NORMAL","0.526102","0.027164","drugY"]} 
  </code></pre>
  
  <p>without the <code>[[</code> at the beginning of data, and that is why it is not working. How can I add this double [?</p>
  
  <p>Any help will be appreciated!</p>