diff --git a/README.md b/README.md index 15e7eba..2d25e15 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ jotform-api-java =============== -[JotForm API](http://api.jotform.com/docs/) - Java Client +[JotForm API](https://api.jotform.com/docs/) - Java Client ### Installation @@ -13,11 +13,11 @@ Install via git clone: ### Documentation -You can find the docs for the API of this client at [http://api.jotform.com/docs/](http://api.jotform.com/docs) +You can find the docs for the API of this client at [https://api.jotform.com/docs/](https://api.jotform.com/docs) ### Authentication -JotForm API requires API key for all user related calls. You can create your API Keys at [API section](http://www.jotform.com/myaccount/api) of My Account page. +JotForm API requires API key for all user related calls. You can create your API Keys at [API section](https://www.jotform.com/myaccount/api) of My Account page. ### Examples diff --git a/src/com/jotform/api/JotForm.java b/src/com/jotform/api/JotForm.java index e08c0b8..ecf9bf1 100644 --- a/src/com/jotform/api/JotForm.java +++ b/src/com/jotform/api/JotForm.java @@ -551,7 +551,47 @@ public JSONObject getReport(long reportID) { public JSONObject getFolder(String folderID) { return executeGetRequest("/folder/" + folderID, null); } + + /** + * Create a folder. + * @param folderProperties Properties of new folder. + * @return Returns report details and URL. + */ + public JSONObject createFolder(HashMap folderProperties){ + return executePostRequest("/folder", folderProperties); + } + /** + * Delete a folder and its subfolders. + * @param folderID You can get folder IDs when you call /user/folders. + * @return Returns status of request. + */ + public JSONObject deleteSubmission(String folderID) { + return executeDeleteRequest("/folder/" + folderID, null); + } + + /** + * Update a specific folder. + * @param folderID You can get folder IDs when you call /user/folders. + * @param folderProperties New properties of the specified folder. + * @return Returns properties of the updated folder. + */ + public JSONObject updateFolder(String folderID, JSONObject folderProperties) { + return executePutRequest("/folder/" + folderID, folderProperties); + } + + public JSONObject addFormsToFolder(String folderID, String[] formIDs) { + JSONArray formArray = new JSONArray(Arrays.asList(formIDs)); + JSONObject data = new JSONObject(); + data.put("forms", formArray); + return this.updateFolder(folderID, data); + } + + public JSONObject addFormToFolder(String folderID, String formID) { + String formIDs[] = { formID }; + return this.addFormsToFolder(folderID, formIDs); + } + /** * Get a list of all properties on a form. * @param formID Form ID is the numbers you see on a form URL. You can get form IDs when you call /user/forms.