Contacts
This module covers contact related operations within Zoho Projects. Use this API to create, update, associate, or delete contacts and manage their details.
This module covers contact related operations within Zoho Projects. Use this API to create, update, associate, or delete contacts and manage their details.
Retrieve all contacts from the Zoho Projects portal.
OAuth Scope:
ZohoProjects.users.READ
String
requiredUnique, immutable identifier of the portal in Zoho Projects. You can obtain it from the Get Portals API (the "id" field in the response).
String
requiredIdentifier of a client. Obtained from the Get Clients API - the "id" field in the response corresponds to client_id.
int
Enter the index of the record.
int
Enter the range of the record.
String
Enter the search term.
Request Example
curl -X GET \
'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts?index=1&range=100&search_string=%5C%5C' \
-H 'Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa'
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts";
params = Map();
params.put("index", "1");
params.put("range", "100");
params.put("search_string", "\\\\");
response = invokeUrl
[
url: url
type: GET
parameters: params
connection: "projects"
];
info response;
const https = require('https');
const url = new URL('https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts');
url.searchParams.append('index', '1');
url.searchParams.append('range', '100');
url.searchParams.append('search_string', '\\\\');
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'GET',
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]/client/[CLIENT_ID]/contacts")
params = {
"index" => "1",
"range" => "100",
"search_string" => "\\\\"
}
url.query = URI.encode_www_form(params)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
response = http.request(request)
puts response.read_body
<?php
$params = [
'index' => '1',
'range' => '100',
'search_string' => '\\\\',
];
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts" . "?" . http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
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]/client/[CLIENT_ID]/contacts"
params = {
"index": "1",
"range": "100",
"search_string": "\\\\"
}
headers = {
"Authorization": "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
}
response = requests.get(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_index = curl_easy_escape(curl, "1", 0);
char *enc_range = curl_easy_escape(curl, "100", 0);
char *enc_search_string = curl_easy_escape(curl, "\\\\\\\\", 0);
char url[2048];
snprintf(url, sizeof(url), "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts?index=%s&range=%s&search_string=%s", enc_index, enc_range, enc_search_string);
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, "GET");
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK)
fprintf(stderr, "curl failed: %s\n", curl_easy_strerror(res));
curl_free(enc_index);
curl_free(enc_range);
curl_free(enc_search_string);
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["index"] = "1";
query["range"] = "100";
query["search_string"] = "\\\\";
var uriBuilder = new UriBuilder("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts") { Query = query.ToString() };
var request = new HttpRequestMessage(HttpMethod.Get, 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_index = curl_easy_escape(curl, "1", 0);
char* enc_range = curl_easy_escape(curl, "100", 0);
char* enc_search_string = curl_easy_escape(curl, "\\\\\\\\", 0);
std::string url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts";
url += "?index=" + std::string(enc_index);
url += "&range=" + std::string(enc_range);
url += "&search_string=" + std::string(enc_search_string);
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, "GET");
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_index);
curl_free(enc_range);
curl_free(enc_search_string);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
(require '[clj-http.client :as client])
(let [enc-index (java.net.URLEncoder/encode "1" "UTF-8")
enc-range (java.net.URLEncoder/encode "100" "UTF-8")
enc-search_string (java.net.URLEncoder/encode "\\\\" "UTF-8")
url (str "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts" "?index=" enc-index "&range=" enc-range "&search_string=" enc-search_string)]
(def response
(client/get 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("GET", "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts", nil)
q := req.URL.Query()
q.Add("index", "1")
q.Add("range", "100")
q.Add("search_string", "\\\\")
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))
}
GET https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts?index=1&range=100&search_string=%5C%5C%5C%5C HTTP/1.1
Host: https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts?index=1&range=100&search_string=%5C%5C%5C%5C
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]/client/[CLIENT_ID]/contacts");
uriBuilder.addParameter("index", "1");
uriBuilder.addParameter("range", "100");
uriBuilder.addParameter("search_string", "\\\\");
HttpUriRequest requestObj = new HttpGet(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]/client/[CLIENT_ID]/contacts';
const params = new URLSearchParams({
'index': '1',
'range': '100',
'search_string': '\\\\'
});
const options = {
method: 'GET',
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));
index = "1"
range = "100"
search_string = "\\\\"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]/client/[CLIENT_ID]/contacts".toHttpUrl().newBuilder()
urlBuilder.addQueryParameter("index", "1")
urlBuilder.addQueryParameter("range", "100")
urlBuilder.addQueryParameter("search_string", "\\\\")
val url = URL(urlBuilder.build().toString())
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "GET"
conn.setRequestProperty("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
val response = conn.inputStream.bufferedReader().readText()
println(response)
}
NSString *encodedIndex = [@"1" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedRange = [@"100" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedSearch_string = [@"\\\\\\\\" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *urlString = [NSString stringWithFormat:@"https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts?index=%@&range=%@&search_string=%@", encodedIndex, encodedRange, encodedSearch_string];
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"GET"];
[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_index = Uri.pct_encode "1" in
let enc_range = Uri.pct_encode "100" in
let enc_search_string = Uri.pct_encode "\\\\" in
let uri = Uri.of_string ("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts" ^ "?index=" ^ enc_index ^ "&range=" ^ enc_range ^ "&search_string=" ^ enc_search_string) in
let headers = Cohttp.Header.init ()
|> fun h -> Cohttp.Header.add h "Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
in
Lwt_main.run (
Client.get ~headers uri >>= fun (_, body) ->
Cohttp_lwt.Body.to_string body >|= fun s ->
print_endline s)
$headers = @{
"Authorization" = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
}
$params = @{
index = "1"
range = "100"
search_string = "\\\\"
}
$queryString = ($params.GetEnumerator() | ForEach-Object { "$($_.Key)=$([System.Uri]::EscapeDataString($_.Value))" }) -join "&"
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts" + "?" + $queryString
$response = Invoke-RestMethod -Uri $url -Method GET -Headers $headers
$response | ConvertTo-Json
library(httr)
url <- "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/client/[CLIENT_ID]/contacts"
params <- list(
index = "1",
range = "100",
search_string = "\\\\"
)
response <- GET(
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]/client/[CLIENT_ID]/contacts")!
components.queryItems = [
URLQueryItem(name: "index", value: "1"),
URLQueryItem(name: "range", value: "100"),
URLQueryItem(name: "search_string", value: "\\\\")
]
let url = components.url!
var request = URLRequest(url: url)
request.httpMethod = "GET"
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
Retrieve details of a contact from the Zoho Projects portal.
OAuth Scope:
ZohoProjects.users.READ
String
requiredUnique, immutable identifier of the portal in Zoho Projects. You can obtain it from the Get Portals API (the "id" field in the response).
String
requiredIdentifier of a contact. Obtained from the Get Contacts API - the "id" field in the response corresponds to contact_id.
Request Example
curl -X GET \
'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]' \
-H 'Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa'
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]";
response = invokeUrl
[
url: url
type: GET
connection: "projects"
];
info response;
const https = require('https');
const url = new URL('https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]');
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'GET',
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]/contacts/[CONTACT_ID]")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
response = http.request(request)
puts response.read_body
<?php
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]";
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
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]/contacts/[CONTACT_ID]"
headers = {
"Authorization": "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
}
response = requests.get(url, headers=headers)
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");
curl_easy_setopt(curl, CURLOPT_URL, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
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.Get, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]");
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");
curl_easy_setopt(curl, CURLOPT_URL, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
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_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
(require '[clj-http.client :as client])
(def response
(client/get "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"
{:headers {"Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"}
:as :json}))
(println (:body response))
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]", nil)
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))
}
GET https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID] HTTP/1.1
Host: https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]
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]/contacts/[CONTACT_ID]");
HttpUriRequest requestObj = new HttpGet(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]/contacts/[CONTACT_ID]';
const options = {
method: 'GET',
headers: {
'Authorization': 'Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa'
}
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
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]/contacts/[CONTACT_ID]")
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "GET"
conn.setRequestProperty("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
val response = conn.inputStream.bufferedReader().readText()
println(response)
}
NSURL *url = [NSURL URLWithString:@"https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"GET"];
[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 uri = Uri.of_string "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" in
let headers = Cohttp.Header.init ()
|> fun h -> Cohttp.Header.add h "Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
in
Lwt_main.run (
Client.get ~headers uri >>= fun (_, body) ->
Cohttp_lwt.Body.to_string body >|= fun s ->
print_endline s)
$headers = @{
"Authorization" = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
}
$response = Invoke-RestMethod -Uri "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" -Method GET -Headers $headers
$response | ConvertTo-Json
library(httr)
url <- "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"
response <- GET(
url,
add_headers(Authorization = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
)
content(response, "text")
import Foundation
let url = URL(string: "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]")!
var request = URLRequest(url: url)
request.httpMethod = "GET"
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 Response
Create new contacts in the Zoho Projects portal.
OAuth Scope:
ZohoProjects.users.CREATE
String
requiredUnique, immutable identifier of the portal in Zoho Projects. You can obtain it from the Get Portals API (the "id" field in the response).
JSONArray
Enter the contact details.
JSONArray
Enter the project IDs. You can obtain it from the Get Projects API (the "id" field in the response).
JSONObject
Enter the project details
long
Enter the customer ID. You can obtain it from the Get Customers API (the "id" field in the response).
String
Enter the customer name.
int
Enter the project ID. You can obtain it from the Get Projects API (the "id" field in the response).
boolean
Specify whether to select all projects. Accepted values: true or false.
String
Specify whether the client is a primary client. Accepted values : yes or no.
int
Enter the customer type. Accepted values: 1 (Business), 2 (Individual).
String
Request Example
curl -X POST \
'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts' \
-H 'Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa' \
--form-string 'contacts=[{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":"4000000017005","all_projects":"false"}]' \
--form-string 'workprojects=["4000000017005"]' \
--form-string 'bulkprojects={"select_all":"false","selected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"unselected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"rateupdatedprojects":"-","costrateupdatedprojects":"-"}' \
--form-string 'clientId=23806000097687000' \
--form-string 'clientName=client admin' \
--form-string 'projectId=23806000097687000' \
--form-string 'all_projects=false' \
--form-string 'primaryclient=yes' \
--form-string 'customer_type=-' \
--form-string 'currency_code=-'
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts";
params = Map();
params.put("contacts", [{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":"4000000017005","all_projects":"false"}]);
params.put("workprojects", ["4000000017005"]);
params.put("bulkprojects", {"select_all":"false","selected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"unselected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"rateupdatedprojects":"-","costrateupdatedprojects":"-"});
params.put("clientId", "23806000097687000");
params.put("clientName", "client admin");
params.put("projectId", "23806000097687000");
params.put("all_projects", "false");
params.put("primaryclient", "yes");
params.put("customer_type", "-");
params.put("currency_code", "-");
response = invokeUrl
[
url: url
type: POST
parameters: params
connection: "projects"
];
info response;
const https = require('https');
const url = new URL('https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts');
url.searchParams.append('contacts', '[{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":"4000000017005","all_projects":"false"}]');
url.searchParams.append('workprojects', '["4000000017005"]');
url.searchParams.append('bulkprojects', '{"select_all":"false","selected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"unselected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"rateupdatedprojects":"-","costrateupdatedprojects":"-"}');
url.searchParams.append('clientId', '23806000097687000');
url.searchParams.append('clientName', 'client admin');
url.searchParams.append('projectId', '23806000097687000');
url.searchParams.append('all_projects', 'false');
url.searchParams.append('primaryclient', 'yes');
url.searchParams.append('customer_type', '-');
url.searchParams.append('currency_code', '-');
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'POST',
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]/contacts")
params = {
"contacts" => "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]",
"workprojects" => "[\"4000000017005\"]",
"bulkprojects" => "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}",
"clientId" => "23806000097687000",
"clientName" => "client admin",
"projectId" => "23806000097687000",
"all_projects" => "false",
"primaryclient" => "yes",
"customer_type" => "-",
"currency_code" => "-"
}
url.query = URI.encode_www_form(params)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
response = http.request(request)
puts response.read_body
<?php
$params = [
'contacts' => '[{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":"4000000017005","all_projects":"false"}]',
'workprojects' => '["4000000017005"]',
'bulkprojects' => '{"select_all":"false","selected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"unselected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"rateupdatedprojects":"-","costrateupdatedprojects":"-"}',
'clientId' => '23806000097687000',
'clientName' => 'client admin',
'projectId' => '23806000097687000',
'all_projects' => 'false',
'primaryclient' => 'yes',
'customer_type' => '-',
'currency_code' => '-',
];
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts" . "?" . http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
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]/contacts"
params = {
"contacts": "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]",
"workprojects": "[\"4000000017005\"]",
"bulkprojects": "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}",
"clientId": "23806000097687000",
"clientName": "client admin",
"projectId": "23806000097687000",
"all_projects": "false",
"primaryclient": "yes",
"customer_type": "-",
"currency_code": "-"
}
headers = {
"Authorization": "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
}
response = requests.post(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_contacts = curl_easy_escape(curl, "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]", 0);
char *enc_workprojects = curl_easy_escape(curl, "[\"4000000017005\"]", 0);
char *enc_bulkprojects = curl_easy_escape(curl, "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}", 0);
char *enc_clientId = curl_easy_escape(curl, "23806000097687000", 0);
char *enc_clientName = curl_easy_escape(curl, "client admin", 0);
char *enc_projectId = curl_easy_escape(curl, "23806000097687000", 0);
char *enc_all_projects = curl_easy_escape(curl, "false", 0);
char *enc_primaryclient = curl_easy_escape(curl, "yes", 0);
char *enc_customer_type = curl_easy_escape(curl, "-", 0);
char *enc_currency_code = curl_easy_escape(curl, "-", 0);
char url[2048];
snprintf(url, sizeof(url), "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts?contacts=%s&workprojects=%s&bulkprojects=%s&clientId=%s&clientName=%s&projectId=%s&all_projects=%s&primaryclient=%s&customer_type=%s¤cy_code=%s", enc_contacts, enc_workprojects, enc_bulkprojects, enc_clientId, enc_clientName, enc_projectId, enc_all_projects, enc_primaryclient, enc_customer_type, enc_currency_code);
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, "POST");
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK)
fprintf(stderr, "curl failed: %s\n", curl_easy_strerror(res));
curl_free(enc_contacts);
curl_free(enc_workprojects);
curl_free(enc_bulkprojects);
curl_free(enc_clientId);
curl_free(enc_clientName);
curl_free(enc_projectId);
curl_free(enc_all_projects);
curl_free(enc_primaryclient);
curl_free(enc_customer_type);
curl_free(enc_currency_code);
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["contacts"] = "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]";
query["workprojects"] = "[\"4000000017005\"]";
query["bulkprojects"] = "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}";
query["clientId"] = "23806000097687000";
query["clientName"] = "client admin";
query["projectId"] = "23806000097687000";
query["all_projects"] = "false";
query["primaryclient"] = "yes";
query["customer_type"] = "-";
query["currency_code"] = "-";
var uriBuilder = new UriBuilder("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts") { Query = query.ToString() };
var request = new HttpRequestMessage(HttpMethod.Post, 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_contacts = curl_easy_escape(curl, "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]", 0);
char* enc_workprojects = curl_easy_escape(curl, "[\"4000000017005\"]", 0);
char* enc_bulkprojects = curl_easy_escape(curl, "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}", 0);
char* enc_clientId = curl_easy_escape(curl, "23806000097687000", 0);
char* enc_clientName = curl_easy_escape(curl, "client admin", 0);
char* enc_projectId = curl_easy_escape(curl, "23806000097687000", 0);
char* enc_all_projects = curl_easy_escape(curl, "false", 0);
char* enc_primaryclient = curl_easy_escape(curl, "yes", 0);
char* enc_customer_type = curl_easy_escape(curl, "-", 0);
char* enc_currency_code = curl_easy_escape(curl, "-", 0);
std::string url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts";
url += "?contacts=" + std::string(enc_contacts);
url += "&workprojects=" + std::string(enc_workprojects);
url += "&bulkprojects=" + std::string(enc_bulkprojects);
url += "&clientId=" + std::string(enc_clientId);
url += "&clientName=" + std::string(enc_clientName);
url += "&projectId=" + std::string(enc_projectId);
url += "&all_projects=" + std::string(enc_all_projects);
url += "&primaryclient=" + std::string(enc_primaryclient);
url += "&customer_type=" + std::string(enc_customer_type);
url += "¤cy_code=" + std::string(enc_currency_code);
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, "POST");
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_contacts);
curl_free(enc_workprojects);
curl_free(enc_bulkprojects);
curl_free(enc_clientId);
curl_free(enc_clientName);
curl_free(enc_projectId);
curl_free(enc_all_projects);
curl_free(enc_primaryclient);
curl_free(enc_customer_type);
curl_free(enc_currency_code);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
(require '[clj-http.client :as client])
(let [enc-contacts (java.net.URLEncoder/encode "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]" "UTF-8")
enc-workprojects (java.net.URLEncoder/encode "[\"4000000017005\"]" "UTF-8")
enc-bulkprojects (java.net.URLEncoder/encode "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}" "UTF-8")
enc-clientId (java.net.URLEncoder/encode "23806000097687000" "UTF-8")
enc-clientName (java.net.URLEncoder/encode "client admin" "UTF-8")
enc-projectId (java.net.URLEncoder/encode "23806000097687000" "UTF-8")
enc-all_projects (java.net.URLEncoder/encode "false" "UTF-8")
enc-primaryclient (java.net.URLEncoder/encode "yes" "UTF-8")
enc-customer_type (java.net.URLEncoder/encode "-" "UTF-8")
enc-currency_code (java.net.URLEncoder/encode "-" "UTF-8")
url (str "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts" "?contacts=" enc-contacts "&workprojects=" enc-workprojects "&bulkprojects=" enc-bulkprojects "&clientId=" enc-clientId "&clientName=" enc-clientName "&projectId=" enc-projectId "&all_projects=" enc-all_projects "&primaryclient=" enc-primaryclient "&customer_type=" enc-customer_type "¤cy_code=" enc-currency_code)]
(def response
(client/post 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("POST", "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts", nil)
q := req.URL.Query()
q.Add("contacts", "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]")
q.Add("workprojects", "[\"4000000017005\"]")
q.Add("bulkprojects", "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}")
q.Add("clientId", "23806000097687000")
q.Add("clientName", "client admin")
q.Add("projectId", "23806000097687000")
q.Add("all_projects", "false")
q.Add("primaryclient", "yes")
q.Add("customer_type", "-")
q.Add("currency_code", "-")
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))
}
POST https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts?contacts=%5B%7B%22email%22%3A%22contacts%40zylker.com%22%2C%22first_name%22%3A%22contact%22%2C%22last_name%22%3A%22admin%22%2C%22invoice_rate%22%3A%22100%22%2C%22projects%22%3A%224000000017005%22%2C%22all_projects%22%3A%22false%22%7D%5D&workprojects=%5B%224000000017005%22%5D&bulkprojects=%7B%22select_all%22%3A%22false%22%2C%22selected%22%3A%7B%22group_ids%22%3A%5B%2223806000097686005%22%5D%2C%22project_ids%22%3A%5B%2223806000097686006%22%5D%7D%2C%22unselected%22%3A%7B%22group_ids%22%3A%5B%2223806000097686005%22%5D%2C%22project_ids%22%3A%5B%2223806000097686006%22%5D%7D%2C%22rateupdatedprojects%22%3A%22-%22%2C%22costrateupdatedprojects%22%3A%22-%22%7D&clientId=23806000097687000&clientName=client+admin&projectId=23806000097687000&all_projects=false&primaryclient=yes&customer_type=-¤cy_code=- HTTP/1.1
Host: https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts?contacts=%5B%7B%22email%22%3A%22contacts%40zylker.com%22%2C%22first_name%22%3A%22contact%22%2C%22last_name%22%3A%22admin%22%2C%22invoice_rate%22%3A%22100%22%2C%22projects%22%3A%224000000017005%22%2C%22all_projects%22%3A%22false%22%7D%5D&workprojects=%5B%224000000017005%22%5D&bulkprojects=%7B%22select_all%22%3A%22false%22%2C%22selected%22%3A%7B%22group_ids%22%3A%5B%2223806000097686005%22%5D%2C%22project_ids%22%3A%5B%2223806000097686006%22%5D%7D%2C%22unselected%22%3A%7B%22group_ids%22%3A%5B%2223806000097686005%22%5D%2C%22project_ids%22%3A%5B%2223806000097686006%22%5D%7D%2C%22rateupdatedprojects%22%3A%22-%22%2C%22costrateupdatedprojects%22%3A%22-%22%7D&clientId=23806000097687000&clientName=client+admin&projectId=23806000097687000&all_projects=false&primaryclient=yes&customer_type=-¤cy_code=-
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]/contacts");
uriBuilder.addParameter("contacts", "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]");
uriBuilder.addParameter("workprojects", "[\"4000000017005\"]");
uriBuilder.addParameter("bulkprojects", "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}");
uriBuilder.addParameter("clientId", "23806000097687000");
uriBuilder.addParameter("clientName", "client admin");
uriBuilder.addParameter("projectId", "23806000097687000");
uriBuilder.addParameter("all_projects", "false");
uriBuilder.addParameter("primaryclient", "yes");
uriBuilder.addParameter("customer_type", "-");
uriBuilder.addParameter("currency_code", "-");
HttpUriRequest requestObj = new HttpPost(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]/contacts';
const params = new URLSearchParams({
'contacts': '[{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":"4000000017005","all_projects":"false"}]',
'workprojects': '["4000000017005"]',
'bulkprojects': '{"select_all":"false","selected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"unselected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"rateupdatedprojects":"-","costrateupdatedprojects":"-"}',
'clientId': '23806000097687000',
'clientName': 'client admin',
'projectId': '23806000097687000',
'all_projects': 'false',
'primaryclient': 'yes',
'customer_type': '-',
'currency_code': '-'
});
const options = {
method: 'POST',
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));
contacts = [{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":"4000000017005","all_projects":"false"}]
workprojects = ["4000000017005"]
bulkprojects = {"select_all":"false","selected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"unselected":{"group_ids":["23806000097686005"],"project_ids":["23806000097686006"]},"rateupdatedprojects":"-","costrateupdatedprojects":"-"}
clientId = "23806000097687000"
clientName = "client admin"
projectId = "23806000097687000"
all_projects = "false"
primaryclient = "yes"
customer_type = -
currency_code = - 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]/contacts".toHttpUrl().newBuilder()
urlBuilder.addQueryParameter("contacts", "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]")
urlBuilder.addQueryParameter("workprojects", "[\"4000000017005\"]")
urlBuilder.addQueryParameter("bulkprojects", "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}")
urlBuilder.addQueryParameter("clientId", "23806000097687000")
urlBuilder.addQueryParameter("clientName", "client admin")
urlBuilder.addQueryParameter("projectId", "23806000097687000")
urlBuilder.addQueryParameter("all_projects", "false")
urlBuilder.addQueryParameter("primaryclient", "yes")
urlBuilder.addQueryParameter("customer_type", "-")
urlBuilder.addQueryParameter("currency_code", "-")
val url = URL(urlBuilder.build().toString())
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "POST"
conn.setRequestProperty("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
val response = conn.inputStream.bufferedReader().readText()
println(response)
}
NSString *encodedContacts = [@"[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedWorkprojects = [@"[\"4000000017005\"]" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedBulkprojects = [@"{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedClientId = [@"23806000097687000" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedClientName = [@"client admin" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedProjectId = [@"23806000097687000" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedAll_projects = [@"false" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedPrimaryclient = [@"yes" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedCustomer_type = [@"-" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedCurrency_code = [@"-" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *urlString = [NSString stringWithFormat:@"https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts?contacts=%@&workprojects=%@&bulkprojects=%@&clientId=%@&clientName=%@&projectId=%@&all_projects=%@&primaryclient=%@&customer_type=%@¤cy_code=%@", encodedContacts, encodedWorkprojects, encodedBulkprojects, encodedClientId, encodedClientName, encodedProjectId, encodedAll_projects, encodedPrimaryclient, encodedCustomer_type, encodedCurrency_code];
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[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_contacts = Uri.pct_encode "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]" in
let enc_workprojects = Uri.pct_encode "[\"4000000017005\"]" in
let enc_bulkprojects = Uri.pct_encode "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}" in
let enc_clientId = Uri.pct_encode "23806000097687000" in
let enc_clientName = Uri.pct_encode "client admin" in
let enc_projectId = Uri.pct_encode "23806000097687000" in
let enc_all_projects = Uri.pct_encode "false" in
let enc_primaryclient = Uri.pct_encode "yes" in
let enc_customer_type = Uri.pct_encode "-" in
let enc_currency_code = Uri.pct_encode "-" in
let uri = Uri.of_string ("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts" ^ "?contacts=" ^ enc_contacts ^ "&workprojects=" ^ enc_workprojects ^ "&bulkprojects=" ^ enc_bulkprojects ^ "&clientId=" ^ enc_clientId ^ "&clientName=" ^ enc_clientName ^ "&projectId=" ^ enc_projectId ^ "&all_projects=" ^ enc_all_projects ^ "&primaryclient=" ^ enc_primaryclient ^ "&customer_type=" ^ enc_customer_type ^ "¤cy_code=" ^ enc_currency_code) in
let headers = Cohttp.Header.init ()
|> fun h -> Cohttp.Header.add h "Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
in
Lwt_main.run (
Client.post ~headers uri >>= fun (_, body) ->
Cohttp_lwt.Body.to_string body >|= fun s ->
print_endline s)
$headers = @{
"Authorization" = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
}
$params = @{
contacts = "[{`"email`":`"contacts@zylker.com`",`"first_name`":`"contact`",`"last_name`":`"admin`",`"invoice_rate`":`"100`",`"projects`":`"4000000017005`",`"all_projects`":`"false`"}]"
workprojects = "[`"4000000017005`"]"
bulkprojects = "{`"select_all`":`"false`",`"selected`":{`"group_ids`":[`"23806000097686005`"],`"project_ids`":[`"23806000097686006`"]},`"unselected`":{`"group_ids`":[`"23806000097686005`"],`"project_ids`":[`"23806000097686006`"]},`"rateupdatedprojects`":`"-`",`"costrateupdatedprojects`":`"-`"}"
clientId = "23806000097687000"
clientName = "client admin"
projectId = "23806000097687000"
all_projects = "false"
primaryclient = "yes"
customer_type = "-"
currency_code = "-"
}
$queryString = ($params.GetEnumerator() | ForEach-Object { "$($_.Key)=$([System.Uri]::EscapeDataString($_.Value))" }) -join "&"
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts" + "?" + $queryString
$response = Invoke-RestMethod -Uri $url -Method POST -Headers $headers
$response | ConvertTo-Json
library(httr)
url <- "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts"
params <- list(
contacts = "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]",
workprojects = "[\"4000000017005\"]",
bulkprojects = "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}",
clientId = "23806000097687000",
clientName = "client admin",
projectId = "23806000097687000",
all_projects = "false",
primaryclient = "yes",
customer_type = "-",
currency_code = "-"
)
response <- POST(
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]/contacts")!
components.queryItems = [
URLQueryItem(name: "contacts", value: "[{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":\"4000000017005\",\"all_projects\":\"false\"}]"),
URLQueryItem(name: "workprojects", value: "[\"4000000017005\"]"),
URLQueryItem(name: "bulkprojects", value: "{\"select_all\":\"false\",\"selected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"unselected\":{\"group_ids\":[\"23806000097686005\"],\"project_ids\":[\"23806000097686006\"]},\"rateupdatedprojects\":\"-\",\"costrateupdatedprojects\":\"-\"}"),
URLQueryItem(name: "clientId", value: "23806000097687000"),
URLQueryItem(name: "clientName", value: "client admin"),
URLQueryItem(name: "projectId", value: "23806000097687000"),
URLQueryItem(name: "all_projects", value: "false"),
URLQueryItem(name: "primaryclient", value: "yes"),
URLQueryItem(name: "customer_type", value: "-"),
URLQueryItem(name: "currency_code", value: "-")
]
let url = components.url!
var request = URLRequest(url: url)
request.httpMethod = "POST"
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
Convert contact to a client user in the Zoho Projects portal.
OAuth Scope:
ZohoProjects.users.CREATE
String
requiredUnique, immutable identifier of the portal in Zoho Projects. You can obtain it from the Get Portals API (the "id" field in the response).
String
requiredIdentifier of a contact. Obtained from the Get Contacts API - the "id" field in the response corresponds to contact_id.
String
Enter the email ID.
long
Enter the profile ID. You can obtain it from the Get Profiles API (the "id" field in the response).
String
Enter the invoice rate of the user. E.g. $30 per hour.
JSONArray
Enter the project IDs. You can obtain it from the Get Projects API (the "id" field in the response).
boolean
Specify whether to select all projects. Accepted values: true or false.
Request Example
curl -X POST \
'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]' \
-H 'Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa' \
--form-string 'email=richard.santos@zylker.com' \
--form-string 'profileId=4000001099097' \
--form-string 'invoice_rate=100' \
--form-string 'workprojects=["4000000017005"]' \
--form-string 'all_projects=false'
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]";
params = Map();
params.put("email", "richard.santos@zylker.com");
params.put("profileId", "4000001099097");
params.put("invoice_rate", "100");
params.put("workprojects", ["4000000017005"]);
params.put("all_projects", "false");
response = invokeUrl
[
url: url
type: POST
parameters: params
connection: "projects"
];
info response;
const https = require('https');
const url = new URL('https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]');
url.searchParams.append('email', 'richard.santos@zylker.com');
url.searchParams.append('profileId', '4000001099097');
url.searchParams.append('invoice_rate', '100');
url.searchParams.append('workprojects', '["4000000017005"]');
url.searchParams.append('all_projects', 'false');
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'POST',
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]/contacts/[CONTACT_ID]")
params = {
"email" => "richard.santos@zylker.com",
"profileId" => "4000001099097",
"invoice_rate" => "100",
"workprojects" => "[\"4000000017005\"]",
"all_projects" => "false"
}
url.query = URI.encode_www_form(params)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
response = http.request(request)
puts response.read_body
<?php
$params = [
'email' => 'richard.santos@zylker.com',
'profileId' => '4000001099097',
'invoice_rate' => '100',
'workprojects' => '["4000000017005"]',
'all_projects' => 'false',
];
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" . "?" . http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
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]/contacts/[CONTACT_ID]"
params = {
"email": "richard.santos@zylker.com",
"profileId": "4000001099097",
"invoice_rate": "100",
"workprojects": "[\"4000000017005\"]",
"all_projects": "false"
}
headers = {
"Authorization": "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
}
response = requests.post(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_email = curl_easy_escape(curl, "richard.santos@zylker.com", 0);
char *enc_profileId = curl_easy_escape(curl, "4000001099097", 0);
char *enc_invoice_rate = curl_easy_escape(curl, "100", 0);
char *enc_workprojects = curl_easy_escape(curl, "[\"4000000017005\"]", 0);
char *enc_all_projects = curl_easy_escape(curl, "false", 0);
char url[2048];
snprintf(url, sizeof(url), "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]?email=%s&profileId=%s&invoice_rate=%s&workprojects=%s&all_projects=%s", enc_email, enc_profileId, enc_invoice_rate, enc_workprojects, enc_all_projects);
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, "POST");
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK)
fprintf(stderr, "curl failed: %s\n", curl_easy_strerror(res));
curl_free(enc_email);
curl_free(enc_profileId);
curl_free(enc_invoice_rate);
curl_free(enc_workprojects);
curl_free(enc_all_projects);
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["email"] = "richard.santos@zylker.com";
query["profileId"] = "4000001099097";
query["invoice_rate"] = "100";
query["workprojects"] = "[\"4000000017005\"]";
query["all_projects"] = "false";
var uriBuilder = new UriBuilder("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]") { Query = query.ToString() };
var request = new HttpRequestMessage(HttpMethod.Post, 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_email = curl_easy_escape(curl, "richard.santos@zylker.com", 0);
char* enc_profileId = curl_easy_escape(curl, "4000001099097", 0);
char* enc_invoice_rate = curl_easy_escape(curl, "100", 0);
char* enc_workprojects = curl_easy_escape(curl, "[\"4000000017005\"]", 0);
char* enc_all_projects = curl_easy_escape(curl, "false", 0);
std::string url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]";
url += "?email=" + std::string(enc_email);
url += "&profileId=" + std::string(enc_profileId);
url += "&invoice_rate=" + std::string(enc_invoice_rate);
url += "&workprojects=" + std::string(enc_workprojects);
url += "&all_projects=" + std::string(enc_all_projects);
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, "POST");
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_email);
curl_free(enc_profileId);
curl_free(enc_invoice_rate);
curl_free(enc_workprojects);
curl_free(enc_all_projects);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
(require '[clj-http.client :as client])
(let [enc-email (java.net.URLEncoder/encode "richard.santos@zylker.com" "UTF-8")
enc-profileId (java.net.URLEncoder/encode "4000001099097" "UTF-8")
enc-invoice_rate (java.net.URLEncoder/encode "100" "UTF-8")
enc-workprojects (java.net.URLEncoder/encode "[\"4000000017005\"]" "UTF-8")
enc-all_projects (java.net.URLEncoder/encode "false" "UTF-8")
url (str "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" "?email=" enc-email "&profileId=" enc-profileId "&invoice_rate=" enc-invoice_rate "&workprojects=" enc-workprojects "&all_projects=" enc-all_projects)]
(def response
(client/post 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("POST", "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]", nil)
q := req.URL.Query()
q.Add("email", "richard.santos@zylker.com")
q.Add("profileId", "4000001099097")
q.Add("invoice_rate", "100")
q.Add("workprojects", "[\"4000000017005\"]")
q.Add("all_projects", "false")
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))
}
POST https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]?email=richard.santos%40zylker.com&profileId=4000001099097&invoice_rate=100&workprojects=%5B%224000000017005%22%5D&all_projects=false HTTP/1.1
Host: https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]?email=richard.santos%40zylker.com&profileId=4000001099097&invoice_rate=100&workprojects=%5B%224000000017005%22%5D&all_projects=false
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]/contacts/[CONTACT_ID]");
uriBuilder.addParameter("email", "richard.santos@zylker.com");
uriBuilder.addParameter("profileId", "4000001099097");
uriBuilder.addParameter("invoice_rate", "100");
uriBuilder.addParameter("workprojects", "[\"4000000017005\"]");
uriBuilder.addParameter("all_projects", "false");
HttpUriRequest requestObj = new HttpPost(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]/contacts/[CONTACT_ID]';
const params = new URLSearchParams({
'email': 'richard.santos@zylker.com',
'profileId': '4000001099097',
'invoice_rate': '100',
'workprojects': '["4000000017005"]',
'all_projects': 'false'
});
const options = {
method: 'POST',
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));
email = "richard.santos@zylker.com"
profileId = "4000001099097"
invoice_rate = "100"
workprojects = ["4000000017005"]
all_projects = "false"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]/contacts/[CONTACT_ID]".toHttpUrl().newBuilder()
urlBuilder.addQueryParameter("email", "richard.santos@zylker.com")
urlBuilder.addQueryParameter("profileId", "4000001099097")
urlBuilder.addQueryParameter("invoice_rate", "100")
urlBuilder.addQueryParameter("workprojects", "[\"4000000017005\"]")
urlBuilder.addQueryParameter("all_projects", "false")
val url = URL(urlBuilder.build().toString())
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "POST"
conn.setRequestProperty("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
val response = conn.inputStream.bufferedReader().readText()
println(response)
}
NSString *encodedEmail = [@"richard.santos@zylker.com" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedProfileId = [@"4000001099097" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedInvoice_rate = [@"100" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedWorkprojects = [@"[\"4000000017005\"]" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *encodedAll_projects = [@"false" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *urlString = [NSString stringWithFormat:@"https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]?email=%@&profileId=%@&invoice_rate=%@&workprojects=%@&all_projects=%@", encodedEmail, encodedProfileId, encodedInvoice_rate, encodedWorkprojects, encodedAll_projects];
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[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_email = Uri.pct_encode "richard.santos@zylker.com" in
let enc_profileId = Uri.pct_encode "4000001099097" in
let enc_invoice_rate = Uri.pct_encode "100" in
let enc_workprojects = Uri.pct_encode "[\"4000000017005\"]" in
let enc_all_projects = Uri.pct_encode "false" in
let uri = Uri.of_string ("https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" ^ "?email=" ^ enc_email ^ "&profileId=" ^ enc_profileId ^ "&invoice_rate=" ^ enc_invoice_rate ^ "&workprojects=" ^ enc_workprojects ^ "&all_projects=" ^ enc_all_projects) in
let headers = Cohttp.Header.init ()
|> fun h -> Cohttp.Header.add h "Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
in
Lwt_main.run (
Client.post ~headers uri >>= fun (_, body) ->
Cohttp_lwt.Body.to_string body >|= fun s ->
print_endline s)
$headers = @{
"Authorization" = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
}
$params = @{
email = "richard.santos@zylker.com"
profileId = "4000001099097"
invoice_rate = "100"
workprojects = "[`"4000000017005`"]"
all_projects = "false"
}
$queryString = ($params.GetEnumerator() | ForEach-Object { "$($_.Key)=$([System.Uri]::EscapeDataString($_.Value))" }) -join "&"
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" + "?" + $queryString
$response = Invoke-RestMethod -Uri $url -Method POST -Headers $headers
$response | ConvertTo-Json
library(httr)
url <- "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"
params <- list(
email = "richard.santos@zylker.com",
profileId = "4000001099097",
invoice_rate = "100",
workprojects = "[\"4000000017005\"]",
all_projects = "false"
)
response <- POST(
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]/contacts/[CONTACT_ID]")!
components.queryItems = [
URLQueryItem(name: "email", value: "richard.santos@zylker.com"),
URLQueryItem(name: "profileId", value: "4000001099097"),
URLQueryItem(name: "invoice_rate", value: "100"),
URLQueryItem(name: "workprojects", value: "[\"4000000017005\"]"),
URLQueryItem(name: "all_projects", value: "false")
]
let url = components.url!
var request = URLRequest(url: url)
request.httpMethod = "POST"
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
Update a contact in the Zoho Projects portal.
OAuth Scope:
ZohoProjects.users.UPDATE
String
requiredUnique, immutable identifier of the portal in Zoho Projects. You can obtain it from the Get Portals API (the "id" field in the response).
String
requiredIdentifier of a contact. Obtained from the Get Contacts API - the "id" field in the response corresponds to contact_id.
String
Enter the email ID.
String
max length : 50Enter the first name.
String
max length : 50Enter the last name.
String
max length : 10Enter the invoice rate of the user. E.g. $30 per hour.
JSONArray
max length : 200000Enter the project IDs. You can obtain it from the Get Projects API (the "id" field in the response).
boolean
Specify whether to select all projects. Accepted values: true or false.
Request Example
curl -X PATCH \
'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]' \
-H 'Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa' \
-H 'Content-Type: application/json' \
-d '{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}'
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]";
params = Map();
params.put("email", "contacts@zylker.com");
params.put("first_name", "contact");
params.put("last_name", "admin");
params.put("invoice_rate", "100");
params.put("projects", ["4000000017005"]);
params.put("all_projects", false);
response = invokeUrl
[
url: url
type: PATCH
parameters: params.toString()
connection: "projects"
];
info response;
const https = require('https');
const url = new URL('https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]');
const payload = JSON.stringify({"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false});
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'PATCH',
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]/contacts/[CONTACT_ID]")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
request["Content-Type"] = "application/json"
request.body = '{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}'
response = http.request(request)
puts response.read_body
<?php
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]";
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => '{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}',
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]/contacts/[CONTACT_ID]"
headers = {
"Authorization": "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
"Content-Type": "application/json",
}
payload = '{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}'
response = requests.patch(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]/contacts/[CONTACT_ID]");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":[\"4000000017005\"],\"all_projects\":false}");
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.Patch, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]");
request.Content = new StringContent(
@"{""email"":""contacts@zylker.com"",""first_name"":""contact"",""last_name"":""admin"",""invoice_rate"":""100"",""projects"":[""4000000017005""],""all_projects"":false}",
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]/contacts/[CONTACT_ID]");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":[\"4000000017005\"],\"all_projects\":false}");
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/patch "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"
{:headers {"Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
"Content-Type" "application/json"}
:body "{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":[\"4000000017005\"],\"all_projects\":false}"
:as :json}))
(println (:body response))
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader("{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":[\"4000000017005\"],\"all_projects\":false}")
req, _ := http.NewRequest("PATCH", "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]", 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))
}
PATCH https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID] HTTP/1.1
Host: https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]
Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa
Content-Type: application/json
{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}
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]/contacts/[CONTACT_ID]");
HttpUriRequest requestObj = new HttpPatch(uriBuilder.build());
requestObj.addHeader("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa");
HttpEntityEnclosingRequestBase requestBase = (HttpEntityEnclosingRequestBase) requestObj;
String requestBody = "{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":[\"4000000017005\"],\"all_projects\":false}";
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]/contacts/[CONTACT_ID]';
const options = {
method: 'PATCH',
headers: {
'Authorization': 'Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa',
'Content-Type': 'application/json'
},
body: JSON.stringify({"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}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]/contacts/[CONTACT_ID]")
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "PATCH"
conn.setRequestProperty("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
conn.setRequestProperty("Content-Type", "application/json")
conn.doOutput = true
conn.outputStream.bufferedWriter().use { it.write("""{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}""") }
val response = conn.inputStream.bufferedReader().readText()
println(response)
}
NSURL *url = [NSURL URLWithString:@"https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"PATCH"];
[request setValue:@"Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa" forHTTPHeaderField:@"Authorization"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSData *body = [@"{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":[\"4000000017005\"],\"all_projects\":false}" 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]/contacts/[CONTACT_ID]" 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|{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}|json} in
Lwt_main.run (
Client.patch ~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 = @'
{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}
'@
$response = Invoke-RestMethod -Uri "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" -Method PATCH -Headers $headers -Body $body
$response | ConvertTo-Json
library(httr)
url <- "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"
response <- PATCH(
url,
add_headers(Authorization = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"),
content_type_json(),
body = "{\"email\":\"contacts@zylker.com\",\"first_name\":\"contact\",\"last_name\":\"admin\",\"invoice_rate\":\"100\",\"projects\":[\"4000000017005\"],\"all_projects\":false}"
)
content(response, "text")
import Foundation
let url = URL(string: "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]")!
var request = URLRequest(url: url)
request.httpMethod = "PATCH"
request.setValue("Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = """
{"email":"contacts@zylker.com","first_name":"contact","last_name":"admin","invoice_rate":"100","projects":["4000000017005"],"all_projects":false}
""".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
Remove a contact from the Zoho Projects portal.
OAuth Scope:
ZohoProjects.users.DELETE
String
requiredUnique, immutable identifier of the portal in Zoho Projects. You can obtain it from the Get Portals API (the "id" field in the response).
String
requiredIdentifier of a contact. Obtained from the Get Contacts API - the "id" field in the response corresponds to contact_id.
Request Example
curl -X DELETE \
'https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]' \
-H 'Authorization: Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa'
url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]";
response = invokeUrl
[
url: url
type: DELETE
connection: "projects"
];
info response;
const https = require('https');
const url = new URL('https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]');
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]/contacts/[CONTACT_ID]")
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
$url = "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]";
$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]/contacts/[CONTACT_ID]"
headers = {
"Authorization": "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa",
}
response = requests.delete(url, headers=headers)
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");
curl_easy_setopt(curl, CURLOPT_URL, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]");
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_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.Delete, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]");
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");
curl_easy_setopt(curl, CURLOPT_URL, "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]");
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_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
(require '[clj-http.client :as client])
(def response
(client/delete "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"
{:headers {"Authorization" "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"}
:as :json}))
(println (:body response))
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("DELETE", "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]", nil)
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]/contacts/[CONTACT_ID] HTTP/1.1
Host: https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]
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]/contacts/[CONTACT_ID]");
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]/contacts/[CONTACT_ID]';
const options = {
method: 'DELETE',
headers: {
'Authorization': 'Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa'
}
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
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]/contacts/[CONTACT_ID]")
val conn = url.openConnection() as HttpURLConnection
conn.requestMethod = "DELETE"
conn.setRequestProperty("Authorization", "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
val response = conn.inputStream.bufferedReader().readText()
println(response)
}
NSURL *url = [NSURL URLWithString:@"https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"];
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 uri = Uri.of_string "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" 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"
}
$response = Invoke-RestMethod -Uri "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]" -Method DELETE -Headers $headers
$response | ConvertTo-Json
library(httr)
url <- "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]"
response <- DELETE(
url,
add_headers(Authorization = "Bearer 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa")
)
content(response, "text")
import Foundation
let url = URL(string: "https://projects.zoho.com/api/v3/portal/[PORTAL_ID]/contacts/[CONTACT_ID]")!
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 Response