Create or Update Section
Add or update a section in the layout.
OAuth Scope:
ZohoProjects.custom_fields.CREATE
Path Parameters
String
requiredregex : [0-9]+
Unique, immutable identifier of the portal in Zoho Projects. You can obtain it from the Get Portals API (the "id" field in the response).
String
requiredregex : [0-9]+
Identifier of a layout. Obtained from the Get Associated Layouts API - the "id" field in the response corresponds to layout_id.
Body Parameters
String
requiredmax length : 100
Enter the module API name or ID. You can obtain it from the Get Modules API (the "id" field in the response).
JSONObject
max length : 1000Specify the position of the section in the layout.
String
Enter the section ID.
String
requiredmax length : 100
Enter the section name.
Request Example
- cURL
- Deluge
- Node.js
- Ruby
- PHP
- Python
- C
- C#
- C++
- Clojure
- Go
- HTTP
- Java
- JS Fetch
- JSON
- Kotlin
- Objective-C
- OCaml
- PowerShell
- R
- Swift
curl -X PUT \
'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections' \
-H 'Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa' \
-H 'Content-Type: application/json' \
-d '{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}'
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections";
params = Map();
params.put("module", "projects");
params.put("position", {"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"});
params.put("id", "4000000062001");
params.put("name", "Simple Entity");
response = invokeUrl
[
url: url
type: PUT
parameters: params.toString()
connection: "projects"
];
info response;
const https = require('https');
const url = new URL('https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections');
const payload = JSON.stringify({"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"});
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'PUT',
headers: {
'Authorization': 'Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa',
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(payload)
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => { data += chunk; });
res.on('end', () => { console.log(JSON.parse(data)); });
});
req.on('error', (err) => { console.error(err); });
req.write(payload);
req.end();
require 'net/http'
require 'uri'
require 'json'
url = URI("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
request["Content-Type"] = "application/json"
request.body = '{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}'
response = http.request(request)
puts response.read_body
<?php
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections";
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => '{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}',
CURLOPT_HTTPHEADER => [
"Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections"
headers = {
"Authorization": "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
"Content-Type": "application/json",
}
payload = '{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}'
response = requests.put(url, headers=headers, data=payload)
print(response.json())
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (curl) {
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"module\":\"projects\",\"position\":{\"before_id\":\"4009123452362\",\"after_id\":\"4009123452345\",\"exact_position\":\"0\",\"known_position\":\"first|last\"},\"id\":\"4000000062001\",\"name\":\"Simple Entity\"}");
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK)
fprintf(stderr, "curl failed: %s\n", curl_easy_strerror(res));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
using System.Net.Http;
using System.Text;
using System.Web;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
var request = new HttpRequestMessage(HttpMethod.Put, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections");
request.Content = new StringContent(
@"{""module"":""projects"",""position"":{""before_id"":""4009123452362"",""after_id"":""4009123452345"",""exact_position"":""0"",""known_position"":""first|last""},""id"":""4000000062001"",""name"":""Simple Entity""}",
Encoding.UTF8,
"application/json"
);
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* output) {
output->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
CURL* curl = curl_easy_init();
if (curl) {
std::string response;
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"module\":\"projects\",\"position\":{\"before_id\":\"4009123452362\",\"after_id\":\"4009123452345\",\"exact_position\":\"0\",\"known_position\":\"first|last\"},\"id\":\"4000000062001\",\"name\":\"Simple Entity\"}");
CURLcode res = curl_easy_perform(curl);
if (res == CURLE_OK)
std::cout << response << std::endl;
else
std::cerr << curl_easy_strerror(res) << std::endl;
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
(require '[clj-http.client :as client])
(def response
(client/put "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections"
{:headers {"Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
"Content-Type" "application/json"}
:body "{\"module\":\"projects\",\"position\":{\"before_id\":\"4009123452362\",\"after_id\":\"4009123452345\",\"exact_position\":\"0\",\"known_position\":\"first|last\"},\"id\":\"4000000062001\",\"name\":\"Simple Entity\"}"
:as :json}))
(println (:body response))
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader("{\"module\":\"projects\",\"position\":{\"before_id\":\"4009123452362\",\"after_id\":\"4009123452345\",\"exact_position\":\"0\",\"known_position\":\"first|last\"},\"id\":\"4000000062001\",\"name\":\"Simple Entity\"}")
req, _ := http.NewRequest("PUT", "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections", payload)
req.Header.Add("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
req.Header.Add("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
PUT https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections HTTP/1.1
Host: https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections
Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa
Content-Type: application/json
{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
SSLContext sslContext = SSLContext.getDefault();
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
CloseableHttpClient httpclient = httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory).build();
URIBuilder uriBuilder = new URIBuilder("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections");
HttpUriRequest requestObj = new HttpPut(uriBuilder.build());
requestObj.addHeader("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
HttpEntityEnclosingRequestBase requestBase = (HttpEntityEnclosingRequestBase) requestObj;
String requestBody = "{\"module\":\"projects\",\"position\":{\"before_id\":\"4009123452362\",\"after_id\":\"4009123452345\",\"exact_position\":\"0\",\"known_position\":\"first|last\"},\"id\":\"4000000062001\",\"name\":\"Simple Entity\"}";
requestBase.setEntity(new StringEntity(requestBody, HTTP.UTF_8));
HttpResponse response = httpclient.execute(requestObj);
HttpEntity responseEntity = response.getEntity();
Object responseObject = EntityUtils.toString(responseEntity);
String responseString = responseObject.toString();
const url = 'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections';
const options = {
method: 'PUT',
headers: {
'Authorization': 'Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa',
'Content-Type': 'application/json'
},
body: JSON.stringify({"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}import java.net.HttpURLConnection
import java.net.URL
import okhttp3.HttpUrl.Companion.toHttpUrl
fun main() {
val url = URL("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections")
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "PUT"
conn.setRequestProperty("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
conn.setRequestProperty("Content-Type", "application/json")
conn.doOutput = true
conn.outputStream.bufferedWriter().use { it.write("""{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}""") }
val response = conn.inputStream.bufferedReader().readText()
println(response)
}
NSURL *url = [NSURL URLWithString:@"https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"PUT"];
[request setValue:@"Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa" forHTTPHeaderField:@"Authorization"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSData *body = [@"{\"module\":\"projects\",\"position\":{\"before_id\":\"4009123452362\",\"after_id\":\"4009123452345\",\"exact_position\":\"0\",\"known_position\":\"first|last\"},\"id\":\"4000000062001\",\"name\":\"Simple Entity\"}" dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:body];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@", result);
}];
[task resume];
open Lwt
open Cohttp_lwt_unix
let () =
let uri = Uri.of_string "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections" in
let headers = Cohttp.Header.init ()
|> fun h -> Cohttp.Header.add h "Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
|> fun h -> Cohttp.Header.add h "Content-Type" "application/json"
in
let body = Cohttp_lwt.Body.of_string {json|{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}|json} in
Lwt_main.run (
Client.put ~headers ~body uri >>= fun (_, body) ->
Cohttp_lwt.Body.to_string body >|= fun s ->
print_endline s)
$headers = @{
"Authorization" = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
"Content-Type" = "application/json"
}
$body = @'
{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}
'@
$response = Invoke-RestMethod -Uri "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections" -Method PUT -Headers $headers -Body $body
$response | ConvertTo-Json
library(httr)
url <- "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections"
response <- PUT(
url,
add_headers(Authorization = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"),
content_type_json(),
body = "{\"module\":\"projects\",\"position\":{\"before_id\":\"4009123452362\",\"after_id\":\"4009123452345\",\"exact_position\":\"0\",\"known_position\":\"first|last\"},\"id\":\"4000000062001\",\"name\":\"Simple Entity\"}"
)
content(response, "text")
import Foundation
let url = URL(string: "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections")!
var request = URLRequest(url: url)
request.httpMethod = "PUT"
request.setValue("Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = """
{"module":"projects","position":{"before_id":"4009123452362","after_id":"4009123452345","exact_position":"0","known_position":"first|last"},"id":"4000000062001","name":"Simple Entity"}
""".data(using: .utf8)
let semaphore = DispatchSemaphore(value: 0)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data, let result = String(data: data, encoding: .utf8) {
print(result)
}
semaphore.signal()
}
task.resume()
semaphore.wait()
Sample Input
Sample Response
Delete Section
Remove a section from a layout. Use Get Layout Details API to retrieve the section_id.
OAuth Scope:
ZohoProjects.custom_fields.DELETE
Path Parameters
String
requiredregex : [0-9]+
Unique, immutable identifier of the portal in Zoho Projects. You can obtain it from the Get Portals API (the "id" field in the response).
String
requiredregex : [0-9]+
Identifier of a layout. Obtained from the Get Associated Layouts API - the "id" field in the response corresponds to layout_id.
String
requiredregex : [0-9]+
Identifier of a section. Obtained from the Get Sections API - the "id" field in the response corresponds to section_id.
Query Parameters
String
requiredEnter the module API name or ID. You can obtain it from the Get Modules API (the "id" field in the response).
Request Example
- cURL
- Deluge
- Node.js
- Ruby
- PHP
- Python
- C
- C#
- C++
- Clojure
- Go
- HTTP
- Java
- JS Fetch
- JSON
- Kotlin
- Objective-C
- OCaml
- PowerShell
- R
- Swift
curl -X DELETE \
'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]?module=projects' \
-H 'Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa'
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]";
params = Map();
params.put("module", "projects");
response = invokeUrl
[
url: url
type: DELETE
parameters: params
connection: "projects"
];
info response;
const https = require('https');
const url = new URL('https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]');
url.searchParams.append('module', 'projects');
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'DELETE',
headers: {
'Authorization': 'Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa'
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => { data += chunk; });
res.on('end', () => { console.log(JSON.parse(data)); });
});
req.on('error', (err) => { console.error(err); });
req.end();
require 'net/http'
require 'uri'
require 'json'
url = URI("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]")
params = {
"module" => "projects"
}
url.query = URI.encode_www_form(params)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
response = http.request(request)
puts response.read_body
<?php
$params = [
'module' => 'projects',
];
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]" . "?" . http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]"
params = {
"module": "projects"
}
headers = {
"Authorization": "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
}
response = requests.delete(url, headers=headers, params=params)
print(response.json())
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (curl) {
char *enc_module = curl_easy_escape(curl, "projects", 0);
char url[2048];
snprintf(url, sizeof(url), "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]?module=%s", enc_module);
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK)
fprintf(stderr, "curl failed: %s\n", curl_easy_strerror(res));
curl_free(enc_module);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
using System.Net.Http;
using System.Text;
using System.Web;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
var query = HttpUtility.ParseQueryString(string.Empty);
query["module"] = "projects";
var uriBuilder = new UriBuilder("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]") { Query = query.ToString() };
var request = new HttpRequestMessage(HttpMethod.Delete, uriBuilder.Uri);
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* output) {
output->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
CURL* curl = curl_easy_init();
if (curl) {
std::string response;
char* enc_module = curl_easy_escape(curl, "projects", 0);
std::string url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]";
url += "?module=" + std::string(enc_module);
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
CURLcode res = curl_easy_perform(curl);
if (res == CURLE_OK)
std::cout << response << std::endl;
else
std::cerr << curl_easy_strerror(res) << std::endl;
curl_free(enc_module);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
(require '[clj-http.client :as client])
(let [enc-module (java.net.URLEncoder/encode "projects" "UTF-8")
url (str "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]" "?module=" enc-module)]
(def response
(client/delete url
{:headers {"Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"}
:as :json}))
(println (:body response))
package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
req, _ := http.NewRequest("DELETE", "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]", nil)
q := req.URL.Query()
q.Add("module", "projects")
req.URL.RawQuery = q.Encode()
req.Header.Add("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
DELETE https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]?module=projects HTTP/1.1
Host: https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]?module=projects
Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
SSLContext sslContext = SSLContext.getDefault();
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
CloseableHttpClient httpclient = httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory).build();
URIBuilder uriBuilder = new URIBuilder("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]");
uriBuilder.addParameter("module", "projects");
HttpUriRequest requestObj = new HttpDelete(uriBuilder.build());
requestObj.addHeader("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
HttpResponse response = httpclient.execute(requestObj);
HttpEntity responseEntity = response.getEntity();
Object responseObject = EntityUtils.toString(responseEntity);
String responseString = responseObject.toString();
const url = 'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]';
const params = new URLSearchParams({
'module': 'projects'
});
const options = {
method: 'DELETE',
headers: {
'Authorization': 'Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa'
}
};
fetch(url + '?' + params.toString(), options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
module = "projects"import java.net.HttpURLConnection
import java.net.URL
import okhttp3.HttpUrl.Companion.toHttpUrl
fun main() {
val urlBuilder = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]".toHttpUrl().newBuilder()
urlBuilder.addQueryParameter("module", "projects")
val url = URL(urlBuilder.build().toString())
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "DELETE"
conn.setRequestProperty("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
val response = conn.inputStream.bufferedReader().readText()
println(response)
}
NSString *encodedModule = [@"projects" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *urlString = [NSString stringWithFormat:@"https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]?module=%@", encodedModule];
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"DELETE"];
[request setValue:@"Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa" forHTTPHeaderField:@"Authorization"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@", result);
}];
[task resume];
open Lwt
open Cohttp_lwt_unix
let () =
let enc_module = Uri.pct_encode "projects" in
let uri = Uri.of_string ("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]" ^ "?module=" ^ enc_module) in
let headers = Cohttp.Header.init ()
|> fun h -> Cohttp.Header.add h "Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
in
Lwt_main.run (
Client.delete ~headers uri >>= fun (_, body) ->
Cohttp_lwt.Body.to_string body >|= fun s ->
print_endline s)
$headers = @{
"Authorization" = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
}
$params = @{
module = "projects"
}
$queryString = ($params.GetEnumerator() | ForEach-Object { "$($_.Key)=$([System.Uri]::EscapeDataString($_.Value))" }) -join "&"
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]" + "?" + $queryString
$response = Invoke-RestMethod -Uri $url -Method DELETE -Headers $headers
$response | ConvertTo-Json
library(httr)
url <- "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]"
params <- list(
module = "projects"
)
response <- DELETE(
url,
add_headers(Authorization = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"),
query = params
)
content(response, "text")
import Foundation
var components = URLComponents(string: "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/settings/layouts/[LAYOUT_ID]/sections/[SECTION_ID]")!
components.queryItems = [
URLQueryItem(name: "module", value: "projects")
]
let url = components.url!
var request = URLRequest(url: url)
request.httpMethod = "DELETE"
request.setValue("Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa", forHTTPHeaderField: "Authorization")
let semaphore = DispatchSemaphore(value: 0)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data, let result = String(data: data, encoding: .utf8) {
print(result)
}
semaphore.signal()
}
task.resume()
semaphore.wait()
Sample Input
Sample Response