From b7fd76ac0e2afc4e37c368e2f034b65d1402f24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umut=20Bu=C4=9Frahan?= Date: Mon, 14 Feb 2022 13:43:45 +0300 Subject: [PATCH 1/2] JotformClient :: add folder methods --- src/com/jotform/api/JotForm.java | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) 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. From ea404ce85f79c4ff851767c0da806960d2cb6d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umut=20Bu=C4=9Frahan?= Date: Mon, 14 Feb 2022 13:44:14 +0300 Subject: [PATCH 2/2] README :: fix url --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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