All,
I am new to OAuth and I can't figure out how to post data. The documentation on the zotero site says:
Creating a Collection
POST /users/1/collections
Content-Type: application/json
X-Zotero-Write-Token: 19a4f01ad623aa7214f82347e3711f56
{
"name" : "My Collection",
"parent" : "QRST9876"
}Now what? Here is what I have:
String str_json = "{\"name\" : \"" + folder_name + "\", \"parent\" : false}";
String apiUrl = "
https://api.zotero.org/users/" + userId + "/collections?key="+secret;
URL url = new URL(apiUrl);
HttpURLConnection request = (HttpURLConnection) url.openConnection();
request.setRequestProperty("Content-Type","application/json");
request.setRequestProperty("collection",str_json);
consumer.sign(request);
request.connect();
return_value = convertStreamToString(request.getInputStream());
System.out.println(return_value);
The "return_value" is just the folders that all ready exist. How and what data do I post? Any help would be appreciated.
Note:
I also tried encoding the JSON string and attaching it to the URL. That didn't change the result.
Thanks,
Doug.