### Go SDK Example for Upload Session Start Batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-start-batch Go example using the standard net/http library to call the upload session start batch endpoint. Replace with a valid access token. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/files/upload_session/start_batch" payload := strings.NewReader("{\n \"num_sessions\": 1\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby SDK Example for Upload Session Start Batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-start-batch Ruby example using Net::HTTP to call the upload session start batch endpoint. Replace with a valid access token. ```ruby require 'uri' require 'net/http' url = URI("https://api.dropboxapi.com/2/files/upload_session/start_batch") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"num_sessions\": 1\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Java SDK Example for Upload Session Start Batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-start-batch Java example using Unirest to call the upload session start batch endpoint. Replace with a valid access token. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.dropboxapi.com/2/files/upload_session/start_batch") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"num_sessions\": 1\n}") .asString(); ``` -------------------------------- ### Swift SDK Example for Upload Session Start Batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-start-batch Swift example using URLSession to call the upload session start batch endpoint. Replace with a valid access token. ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["num_sessions": 1] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.dropboxapi.com/2/files/upload_session/start_batch")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### JavaScript SDK Example for Upload Session Start Batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-start-batch JavaScript example using fetch to call the upload session start batch endpoint. Replace with a valid access token. ```javascript const url = 'https://api.dropboxapi.com/2/files/upload_session/start_batch'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"num_sessions":1}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Python SDK Example for Upload Session Start Batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-start-batch Python example using the requests library to call the upload session start batch endpoint. Replace with a valid access token. ```python import requests url = "https://api.dropboxapi.com/2/files/upload_session/start_batch" payload = { "num_sessions": 1 } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### PHP SDK Example for Upload Session Start Batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-start-batch PHP example using Guzzle to call the upload session start batch endpoint. Replace with a valid access token. ```php request('POST', 'https://api.dropboxapi.com/2/files/upload_session/start_batch', [ 'body' => '{ "num_sessions": 1 }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK example for properties/search/continue Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/file-properties/properties-search-continue Uses net/http to send a POST request with the cursor and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/file_properties/properties/search/continue" payload := strings.NewReader("{\n \"cursor\": \"ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK example for docs/list/continue Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/paper/docs-list-continue Uses net/http to send a POST request with the cursor and prints the response status and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/paper/docs/list/continue" payload := strings.NewReader("{\n \"cursor\": \"U60b6BxT43ySd5sAVQbbIvoteSnWLjUdLU7aR25hbt3ySd5sAVQbbIvoteSnWLjUd\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### C# SDK Example for Upload Session Start Batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-start-batch C# example using RestSharp to call the upload session start batch endpoint. Replace with a valid access token. ```csharp using RestSharp; var client = new RestClient("https://api.dropboxapi.com/2/files/upload_session/start_batch"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"num_sessions\": 1\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Go SDK Example Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/properties-update Go example using net/http to update file properties. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/files/properties/update" payload := strings.NewReader("{\n \"path\": \"/my_awesome/word.docx\",\n \"update_property_groups\": [\n {\n \"template_id\": \"ptid:1a5n2i6d3OYEAAAAAAAAAYa\",\n \"add_or_update_fields\": [\n {\n \"name\": \"Security Policy\",\n \"value\": \"Confidential\"\n }\n ],\n \"remove_fields\": []\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby SDK example for docs/list/continue Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/paper/docs-list-continue Uses net/http to POST the cursor and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.dropboxapi.com/2/paper/docs/list/continue") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"cursor\": \"U60b6BxT43ySd5sAVQbbIvoteSnWLjUdLU7aR25hbt3ySd5sAVQbbIvoteSnWLjUd\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Go SDK example for users/features/get_values Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/users/features-get-values.md Go example using net/http to POST to the endpoint. Requires a valid bearer token. Prints the response and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/users/features/get_values" payload := strings.NewReader("{\n \"features\": [\n {\n \".tag\": \"paper_as_files\"\n },\n {\n \".tag\": \"file_locking\"\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK example for /2/team/sharing_allowlist/list/continue Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/sharing-allowlist-list-continue Uses net/http to send a POST request with the cursor and prints the response status and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/team/sharing_allowlist/list/continue" payload := strings.NewReader("{\n \"cursor\": \"dGVzdF9jdXJzb3IK\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby SDK example for properties/search/continue Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/file-properties/properties-search-continue Uses net/http to POST the cursor and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.dropboxapi.com/2/file_properties/properties/search/continue") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"cursor\": \"ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Get file metadata with files_get_metadata Source: https://docs.dropboxapi.com/dropbox-api/docs/sdks/python Gets metadata for a file and prints the server_modified timestamp. The output shows an example timestamp. ```python print(dbx.files_get_metadata('/Cavs vs Warriors/Game 5/story.txt').server_modified) # OUTPUT: # 2015-06-15 02:45:12 ``` -------------------------------- ### Go SDK example for list_member_linked_apps Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/linked-apps-list-member-linked-apps Go example using net/http to POST to the list_member_linked_apps endpoint. Requires a bearer token. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/team/linked_apps/list_member_linked_apps" payload := strings.NewReader("{\n \"team_member_id\": \"dbmid:AAFdgehTzw7WlXhZJsbGCLePe8RvQGYDr-I\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### PHP Example: Add Excluded Users Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/member-space-limits-excluded-users-add PHP example using Guzzle HTTP client. Requires Guzzle to be installed via Composer. ```php request('POST', 'https://api.dropboxapi.com/2/team/member_space_limits/excluded_users/add', [ 'body' => '{ "users": [ { ".tag": "team_member_id", "team_member_id": "dbmid:efgh5678" } ] }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK example for team/namespaces/list/continue Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/namespaces-list-continue Uses net/http to POST to the endpoint with a cursor in the body. Requires an authorization token. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/team/namespaces/list/continue" payload := strings.NewReader("{\n \"cursor\": \"ZtkX9_EHj3x7PMkVuFIhwKYXEpwpLwyxp9vMKomUhllil9q7eWiAu\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### PHP SDK Example for copy_batch_v2 Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/copy-batch-v-2 PHP example using Guzzle to POST to the copy_batch_v2 endpoint. Requires Guzzle installed via Composer and a valid bearer token. ```php request('POST', 'https://api.dropboxapi.com/2/files/copy_batch_v2', [ 'body' => '{ "entries": [ { "from_path": "string", "to_path": "string" } ] }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK Example for /2/files/tags/add Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/tags-add Uses net/http to send a POST request. Requires a valid access token. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/files/tags/add" payload := strings.NewReader("{\n \"path\": \"/Prime_Numbers.txt\",\n \"tag_text\": \"my_tag\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### POST /2/users/get_account Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/users/get-account.md Example request and response for the Dropbox API endpoint to get account information. ```APIDOC ## POST /2/users/get_account ### Description Retrieves information about a user's account using the account ID. ### Method POST ### Endpoint https://api.dropboxapi.com/2/users/get_account ### Parameters #### Request Body - **account_id** (string) - Required - The account ID of the user. ### Request Example { "account_id": "dbid:AAH4f99T0taONIb-OurWxbNQ6ywGRopQngc" } ### Response #### Success Response (200) - **account_id** (string) - The account ID. - **disabled** (boolean) - Whether the account is disabled. - **email** (string) - The user's email address. - **email_verified** (boolean) - Whether the email is verified. - **is_teammate** (boolean) - Whether the user is a teammate. - **name** (object) - The user's name details. - **abbreviated_name** (string) - Abbreviated name. - **display_name** (string) - Display name. - **familiar_name** (string) - Familiar name. - **given_name** (string) - Given name. - **surname** (string) - Surname. - **profile_photo_url** (string) - URL to the profile photo. #### Response Example { "account_id": "dbid:AAH4f99T0taONIb-OurWxbNQ6ywGRopQngc", "disabled": false, "email": "franz@dropbox.com", "email_verified": true, "is_teammate": false, "name": { "abbreviated_name": "FF", "display_name": "Franz Ferdinand (Personal)", "familiar_name": "Franz", "given_name": "Franz", "surname": "Ferdinand" }, "profile_photo_url": "https://dl-web.dropbox.com/account_photo/get/dbaphid%3AAAHWGmIXV3sUuOmBfTz0wPsiqHUpBWvv3ZA?vers=1556069330102&size=128x128" } ``` -------------------------------- ### Example 1: Go SDK code for files.copy_batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/copy-batch Go example using net/http to POST to the files.copy_batch endpoint. Requires an access token in the Authorization header. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/files/copy_batch" payload := strings.NewReader("{\n \"entries\": [\n {\n \"from_path\": \"/Homework/math\",\n \"to_path\": \"/Homework/algebra\"\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### POST /2/sharing/get_folder_metadata Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/sharing/get-folder-metadata Swift example demonstrating how to call the Dropbox API endpoint to get folder metadata. ```APIDOC ## [POST] /2/sharing/get_folder_metadata ### Description Retrieves metadata for a shared folder. ### Method POST ### Endpoint https://api.dropboxapi.com/2/sharing/get_folder_metadata ### Parameters #### Request Body - **shared_folder_id** (string) - Required - The ID of the shared folder. - **actions** (array) - Required - A list of actions to include in the response. ### Request Example { "shared_folder_id": "84528192421", "actions": [] } ### Response #### Success Response (200) Returns the metadata for the shared folder. #### Response Example { "shared_folder_id": "84528192421", "actions": [] } ``` -------------------------------- ### Create Folder with Go (net/http) Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/create-folder Go example using the standard net/http library. Sends a POST request with a JSON payload and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/files/create_folder" payload := strings.NewReader("{\n \"path\": \"/Homework/math\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### POST /2/files/get_thumbnail_batch Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/get-thumbnail-batch Example of how to call the Dropbox API endpoint to get a batch of thumbnails using Swift. ```APIDOC ## POST /2/files/get_thumbnail_batch ### Description Generates a batch of thumbnails for a set of files. This endpoint is used to retrieve thumbnails for multiple files in a single request. ### Method POST ### Endpoint https://content.dropboxapi.com/2/files/get_thumbnail_batch ### Parameters #### Request Body - **entries** (array) - Required - List of thumbnail requests. Each entry contains: - **path** (string) - Required - The path to the file for which a thumbnail is requested. - **format** (object) - Required - The format of the thumbnail. Must be a tag with value "jpeg". ### Request Example ```json { "entries": [ { "path": "/image.jpg", "format": {".tag": "jpeg"} } ] } ``` ### Response #### Success Response (200) Returns the batch of thumbnails. The response structure is not detailed in the source. #### Response Example Not provided in the source. ### Error Handling No error handling details are provided in the source. ``` -------------------------------- ### Swift SDK Example for team/groups/job_status/get Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/groups-job-status-get Swift example using URLSession to POST to the Dropbox API team/groups/job_status/get endpoint. It sets the Authorization and Content-Type headers, serializes the async_job_id parameter to JSON, and starts the data task. ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["async_job_id": "34g93hh34h04y384084"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.dropboxapi.com/2/team/groups/job_status/get")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### POST /2/users/get_current_account Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/users/get-current-account.md Example code snippets for calling the Dropbox API endpoint to get the current account information. ```APIDOC ## POST /2/users/get_current_account ### Description Retrieves information about the current user's account. ### Method POST ### Endpoint https://api.dropboxapi.com/2/users/get_current_account ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. ### Request Example No request body is required. ### Response #### Success Response (200) - **account_id** (string) - The user's unique Dropbox account ID. - **account_type** (object) - The account type (e.g., basic, pro, business). - **disabled** (boolean) - Whether the account is disabled. - **email** (string) - The user's email address. - **email_verified** (boolean) - Whether the email is verified. - **is_paired** (boolean) - Whether the account is paired. - **locale** (string) - The user's locale. - **name** (object) - The user's name details. - **referral_link** (string) - The user's referral link. - **root_info** (object) - The root namespace information. - **country** (string) - The user's country. - **profile_photo_url** (string) - URL to the user's profile photo. - **team** (object) - Team information, if the user belongs to a team. #### Response Example ```json { "account_id": "dbid:AAH4f99T0taONIb-OurWxbNQ6ywGRopQngc", "account_type": { ".tag": "basic", "basic": null }, "disabled": false, "email": "franz@gmail.com", "email_verified": false, "is_paired": false, "locale": "en", "name": { "abbreviated_name": "FF", "display_name": "Franz Ferdinand (Personal)", "familiar_name": "Franz", "given_name": "Franz", "surname": "Ferdinand" }, "referral_link": "https://db.tt/ZITNuhtI", "root_info": { ".tag": "user", "home_namespace_id": "3235641", "root_namespace_id": "3235641" }, "country": "US", "profile_photo_url": "https://dl-web.dropbox.com/account_photo/get/dbaphid%3AAAHWGmIXV3sUuOmBfTz0wPsiqHUpBWvv3ZA?vers=1556069330102&size=128x128", "team": null } ``` ``` -------------------------------- ### Go SDK example for file_requests/get Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/file-requests/get Go example using net/http to POST to the file_requests/get endpoint. Requires a valid access token in the Authorization header. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/file_requests/get" payload := strings.NewReader("{\n \"id\": \"oaCAVmEyrqYnkZX9955Y\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK Example 1 Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/upload-session-finish-batch Go example using net/http to POST to the finish_batch endpoint. Requires a valid bearer token. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/files/upload_session/finish_batch" payload := strings.NewReader("{\n \"entries\": [\n {\n \"commit\": {\n \"path\": \"/Homework/math/Matrices.txt\",\n \"autorename\": true\n },\n \"cursor\": {\n \"offset\": 0,\n \"session_id\": \"pid_upload_session:h-NtwvAdw3XDqqHmb0J2t0XfIaSnQw2Eor59pfZI9D_ZGNJ4Ew\"\n }\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### POST /2/team/members/remove/job_status/get Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/members-remove-job-status-get Example request and response for the Dropbox API endpoint to get the status of a member removal job. ```APIDOC ## POST /2/team/members/remove/job_status/get ### Description This endpoint retrieves the status of an asynchronous job that removes a member from the team. It is used to poll the result of a previous `members/remove` call. ### Method POST ### Endpoint https://api.dropboxapi.com/2/team/members/remove/job_status/get ### Parameters #### Request Body - **async_job_id** (string) - Required - The ID of the asynchronous job to check. ### Request Example { "async_job_id": "34g93hh34h04y384084" } ### Response #### Success Response (200) - **.tag** (string) - The status of the job. Possible values include "complete" and "failed". - **complete** (null) - Present when the job is complete. #### Response Example { ".tag": "complete", "complete": null } ``` -------------------------------- ### Go SDK example for template/get Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/properties-template-get Uses the net/http package to send a POST request with the template_id. Prints the response status and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.dropboxapi.com/2/team/properties/template/get" payload := strings.NewReader("{\n \"template_id\": \"ptid:1a5n2i6d3OYEAAAAAAAAAYa\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Java SDK code for move_batch/check_v2 Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/files/move-batch-check-v-2 Java example using Unirest to POST to the move_batch/check_v2 endpoint and get the response as a string. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.dropboxapi.com/2/files/move_batch/check_v2") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"async_job_id\": \"34g93hh34h04y384084\"\n}") .asString(); ``` -------------------------------- ### PHP SDK example for docs/list/continue Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/paper/docs-list-continue Uses GuzzleHttp to POST the cursor and echoes the response body. ```php request('POST', 'https://api.dropboxapi.com/2/paper/docs/list/continue', [ 'body' => '{ "cursor": "U60b6BxT43ySd5sAVQbbIvoteSnWLjUdLU7aR25hbt3ySd5sAVQbbIvoteSnWLjUd" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### Get group info via Dropbox API (C# and Swift) Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/groups-get-info Both examples call the Dropbox API endpoint /2/team/groups/get_info with a POST request, sending a JSON body that specifies the group_ids to retrieve. The C# example uses RestSharp, while the Swift example uses URLSession. Replace the placeholder with a valid access token. ```csharp using RestSharp; var client = new RestClient("https://api.dropboxapi.com/2/team/groups/get_info"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \".tag\": \"group_ids\",\n \"group_ids\": [\n \"g:e2db7665347abcd600000000001a2b3c\",\n \"g:111111147abcd6000000000222222c\"\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ ".tag": "group_ids", "group_ids": ["g:e2db7665347abcd600000000001a2b3c", "g:111111147abcd6000000000222222c"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.dropboxapi.com/2/team/groups/get_info")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### PHP Guzzle call to check/user Source: https://docs.dropboxapi.com/dropbox-api/api-reference/user-endpoints/check/user PHP example using Guzzle to POST to check/user. Requires Guzzle installed via Composer. ```php request('POST', 'https://api.dropboxapi.com/2/check/user', [ 'body' => '{ "query": "foo" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### Ruby SDK example for /2/team/sharing_allowlist/list/continue Source: https://docs.dropboxapi.com/dropbox-api/api-reference/business-endpoints/team/sharing-allowlist-list-continue Uses Net::HTTP to POST the cursor and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.dropboxapi.com/2/team/sharing_allowlist/list/continue") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"cursor\": \"dGVzdF9jdXJzb3IK\"\n}" response = http.request(request) puts response.read_body ```