Back to Collection Items
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
boolean success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "LicenseType": "DEVELOPER",
// "AutoActivate": true
// }
CkJsonObject json = new CkJsonObject();
json.UpdateString("LicenseType","DEVELOPER");
json.UpdateBool("AutoActivate",true);
// Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>");
http.SetRequestHeader("Content-Type","application/json");
CkStringBuilder sbRequestBody = new CkStringBuilder();
json.EmitSb(sbRequestBody);
CkHttpResponse resp = http.PTextSb("PATCH","https://domain.com/services/data/v{{version}}/tooling/sobjects/SandboxInfo/:SANDBOX_INFO_ID",sbRequestBody,"utf-8","application/json",false,false);
if (http.get_LastMethodSuccess() == false) {
System.out.println(http.lastErrorText());
return;
}
System.out.println(resp.get_StatusCode());
System.out.println(resp.bodyStr());
}
}
Curl Command
curl -X PATCH
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"LicenseType": "DEVELOPER",
"AutoActivate": true
}'
https://domain.com/services/data/v{{version}}/tooling/sobjects/SandboxInfo/:SANDBOX_INFO_ID
Postman Collection Item JSON
{
"name": "Refresh Sandbox",
"request": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"LicenseType\": \"DEVELOPER\",\n \"AutoActivate\": true\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/tooling/sobjects/SandboxInfo/:SANDBOX_INFO_ID",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"tooling",
"sobjects",
"SandboxInfo",
":SANDBOX_INFO_ID"
],
"variable": [
{
"key": "SANDBOX_INFO_ID",
"value": ""
}
]
},
"description": "Refreshes a sandbox."
},
"response": [
{
"name": "Refresh Sandbox",
"originalRequest": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"LicenseType\": \"DEVELOPER\",\n \"AutoActivate\": true\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/tooling/sobjects/SandboxInfo/:SANDBOX_INFO_ID",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"tooling",
"sobjects",
"SandboxInfo",
":SANDBOX_INFO_ID"
],
"variable": [
{
"key": "SANDBOX_INFO_ID",
"value": "0GQ4H000000CxSzWAK"
}
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "plain",
"header": [
{
"key": "Date",
"value": "Wed, 13 Dec 2023 12:33:55 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Content-Security-Policy",
"value": "upgrade-insecure-requests"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Sforce-Limit-Info",
"value": "api-usage=2/15000"
}
],
"cookie": [
],
"body": null
}
]
}