Products
DELETE
Archive
{{baseUrl}}/crm/v3/objects/products/:productId
QUERY PARAMS
productId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/:productId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/crm/v3/objects/products/:productId")
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/:productId"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/:productId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/:productId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/:productId"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/crm/v3/objects/products/:productId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/crm/v3/objects/products/:productId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/:productId"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/:productId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/crm/v3/objects/products/:productId")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/crm/v3/objects/products/:productId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/crm/v3/objects/products/:productId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/:productId';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/:productId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/:productId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/:productId',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/crm/v3/objects/products/:productId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/crm/v3/objects/products/:productId');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/crm/v3/objects/products/:productId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/:productId';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/:productId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/:productId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/:productId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/crm/v3/objects/products/:productId');
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/:productId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/crm/v3/objects/products/:productId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/:productId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/:productId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/crm/v3/objects/products/:productId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/:productId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/:productId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/:productId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/crm/v3/objects/products/:productId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/:productId";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/crm/v3/objects/products/:productId
http DELETE {{baseUrl}}/crm/v3/objects/products/:productId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/:productId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/:productId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
POST
Create
{{baseUrl}}/crm/v3/objects/products
BODY json
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"properties": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/crm/v3/objects/products" {:content-type :json
:form-params {:associations [{:types [{:associationCategory ""
:associationTypeId 0}]
:to {:id ""}}]
:properties {}}})
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products"),
Content = new StringContent("{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products"
payload := strings.NewReader("{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/crm/v3/objects/products HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 214
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"properties": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/crm/v3/objects/products")
.setHeader("content-type", "application/json")
.setBody("{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/crm/v3/objects/products")
.header("content-type", "application/json")
.body("{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}")
.asString();
const data = JSON.stringify({
associations: [
{
types: [
{
associationCategory: '',
associationTypeId: 0
}
],
to: {
id: ''
}
}
],
properties: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/crm/v3/objects/products');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products',
headers: {'content-type': 'application/json'},
data: {
associations: [{types: [{associationCategory: '', associationTypeId: 0}], to: {id: ''}}],
properties: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"associations":[{"types":[{"associationCategory":"","associationTypeId":0}],"to":{"id":""}}],"properties":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "associations": [\n {\n "types": [\n {\n "associationCategory": "",\n "associationTypeId": 0\n }\n ],\n "to": {\n "id": ""\n }\n }\n ],\n "properties": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
associations: [{types: [{associationCategory: '', associationTypeId: 0}], to: {id: ''}}],
properties: {}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products',
headers: {'content-type': 'application/json'},
body: {
associations: [{types: [{associationCategory: '', associationTypeId: 0}], to: {id: ''}}],
properties: {}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/crm/v3/objects/products');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
associations: [
{
types: [
{
associationCategory: '',
associationTypeId: 0
}
],
to: {
id: ''
}
}
],
properties: {}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products',
headers: {'content-type': 'application/json'},
data: {
associations: [{types: [{associationCategory: '', associationTypeId: 0}], to: {id: ''}}],
properties: {}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"associations":[{"types":[{"associationCategory":"","associationTypeId":0}],"to":{"id":""}}],"properties":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"associations": @[ @{ @"types": @[ @{ @"associationCategory": @"", @"associationTypeId": @0 } ], @"to": @{ @"id": @"" } } ],
@"properties": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'associations' => [
[
'types' => [
[
'associationCategory' => '',
'associationTypeId' => 0
]
],
'to' => [
'id' => ''
]
]
],
'properties' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/crm/v3/objects/products', [
'body' => '{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"properties": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'associations' => [
[
'types' => [
[
'associationCategory' => '',
'associationTypeId' => 0
]
],
'to' => [
'id' => ''
]
]
],
'properties' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'associations' => [
[
'types' => [
[
'associationCategory' => '',
'associationTypeId' => 0
]
],
'to' => [
'id' => ''
]
]
],
'properties' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/crm/v3/objects/products');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"properties": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"properties": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/crm/v3/objects/products", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products"
payload = {
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": { "id": "" }
}
],
"properties": {}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products"
payload <- "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/crm/v3/objects/products') do |req|
req.body = "{\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"properties\": {}\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products";
let payload = json!({
"associations": (
json!({
"types": (
json!({
"associationCategory": "",
"associationTypeId": 0
})
),
"to": json!({"id": ""})
})
),
"properties": json!({})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/crm/v3/objects/products \
--header 'content-type: application/json' \
--data '{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"properties": {}
}'
echo '{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"properties": {}
}' | \
http POST {{baseUrl}}/crm/v3/objects/products \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "associations": [\n {\n "types": [\n {\n "associationCategory": "",\n "associationTypeId": 0\n }\n ],\n "to": {\n "id": ""\n }\n }\n ],\n "properties": {}\n}' \
--output-document \
- {{baseUrl}}/crm/v3/objects/products
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"associations": [
[
"types": [
[
"associationCategory": "",
"associationTypeId": 0
]
],
"to": ["id": ""]
]
],
"properties": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
GET
List
{{baseUrl}}/crm/v3/objects/products
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/crm/v3/objects/products")
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/crm/v3/objects/products HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/crm/v3/objects/products")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/crm/v3/objects/products")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/crm/v3/objects/products');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/crm/v3/objects/products'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/crm/v3/objects/products'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/crm/v3/objects/products');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/crm/v3/objects/products'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/crm/v3/objects/products');
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/crm/v3/objects/products');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/crm/v3/objects/products")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/crm/v3/objects/products') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/crm/v3/objects/products
http GET {{baseUrl}}/crm/v3/objects/products
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/crm/v3/objects/products
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"paging": {
"next": {
"after": "NTI1Cg%3D%3D",
"link": "?after=NTI1Cg%3D%3D"
}
},
"results": [
{
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
}
}
]
}
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
GET
Read
{{baseUrl}}/crm/v3/objects/products/:productId
QUERY PARAMS
productId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/:productId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/crm/v3/objects/products/:productId")
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/:productId"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/:productId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/:productId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/:productId"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/crm/v3/objects/products/:productId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/crm/v3/objects/products/:productId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/:productId"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/:productId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/crm/v3/objects/products/:productId")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/crm/v3/objects/products/:productId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/crm/v3/objects/products/:productId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/:productId';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/:productId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/:productId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/:productId',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/crm/v3/objects/products/:productId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/crm/v3/objects/products/:productId');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/crm/v3/objects/products/:productId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/:productId';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/:productId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/:productId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/:productId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/crm/v3/objects/products/:productId');
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/:productId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/crm/v3/objects/products/:productId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/:productId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/:productId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/crm/v3/objects/products/:productId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/:productId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/:productId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/:productId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/crm/v3/objects/products/:productId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/:productId";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/crm/v3/objects/products/:productId
http GET {{baseUrl}}/crm/v3/objects/products/:productId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/:productId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/:productId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
}
}
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
PATCH
Update
{{baseUrl}}/crm/v3/objects/products/:productId
QUERY PARAMS
productId
BODY json
{
"properties": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/:productId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"properties\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/crm/v3/objects/products/:productId" {:content-type :json
:form-params {:properties {}}})
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/:productId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"properties\": {}\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/:productId"),
Content = new StringContent("{\n \"properties\": {}\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/:productId");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"properties\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/:productId"
payload := strings.NewReader("{\n \"properties\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/crm/v3/objects/products/:productId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 22
{
"properties": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/crm/v3/objects/products/:productId")
.setHeader("content-type", "application/json")
.setBody("{\n \"properties\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/:productId"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"properties\": {}\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"properties\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/:productId")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/crm/v3/objects/products/:productId")
.header("content-type", "application/json")
.body("{\n \"properties\": {}\n}")
.asString();
const data = JSON.stringify({
properties: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/crm/v3/objects/products/:productId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/crm/v3/objects/products/:productId',
headers: {'content-type': 'application/json'},
data: {properties: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/:productId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"properties":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/:productId',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "properties": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"properties\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/:productId")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/:productId',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({properties: {}}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/crm/v3/objects/products/:productId',
headers: {'content-type': 'application/json'},
body: {properties: {}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/crm/v3/objects/products/:productId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
properties: {}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/crm/v3/objects/products/:productId',
headers: {'content-type': 'application/json'},
data: {properties: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/:productId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"properties":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"properties": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/:productId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/:productId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"properties\": {}\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/:productId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'properties' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/crm/v3/objects/products/:productId', [
'body' => '{
"properties": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/:productId');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'properties' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'properties' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/crm/v3/objects/products/:productId');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/:productId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"properties": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/:productId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"properties": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"properties\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/crm/v3/objects/products/:productId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/:productId"
payload = { "properties": {} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/:productId"
payload <- "{\n \"properties\": {}\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/:productId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"properties\": {}\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/crm/v3/objects/products/:productId') do |req|
req.body = "{\n \"properties\": {}\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/:productId";
let payload = json!({"properties": json!({})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/crm/v3/objects/products/:productId \
--header 'content-type: application/json' \
--data '{
"properties": {}
}'
echo '{
"properties": {}
}' | \
http PATCH {{baseUrl}}/crm/v3/objects/products/:productId \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "properties": {}\n}' \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/:productId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["properties": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/:productId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
POST
Archive a batch of products by ID
{{baseUrl}}/crm/v3/objects/products/batch/archive
BODY json
{
"inputs": [
{
"id": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/batch/archive");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/crm/v3/objects/products/batch/archive" {:content-type :json
:form-params {:inputs [{:id ""}]}})
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/batch/archive"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/batch/archive"),
Content = new StringContent("{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/batch/archive");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/batch/archive"
payload := strings.NewReader("{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/crm/v3/objects/products/batch/archive HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 48
{
"inputs": [
{
"id": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/crm/v3/objects/products/batch/archive")
.setHeader("content-type", "application/json")
.setBody("{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/batch/archive"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/archive")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/crm/v3/objects/products/batch/archive")
.header("content-type", "application/json")
.body("{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
inputs: [
{
id: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/crm/v3/objects/products/batch/archive');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/archive',
headers: {'content-type': 'application/json'},
data: {inputs: [{id: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/batch/archive';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"inputs":[{"id":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/batch/archive',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "inputs": [\n {\n "id": ""\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/archive")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/batch/archive',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({inputs: [{id: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/archive',
headers: {'content-type': 'application/json'},
body: {inputs: [{id: ''}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/crm/v3/objects/products/batch/archive');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
inputs: [
{
id: ''
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/archive',
headers: {'content-type': 'application/json'},
data: {inputs: [{id: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/batch/archive';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"inputs":[{"id":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"inputs": @[ @{ @"id": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/batch/archive"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/batch/archive" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/batch/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
[
'id' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/crm/v3/objects/products/batch/archive', [
'body' => '{
"inputs": [
{
"id": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/batch/archive');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'inputs' => [
[
'id' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'inputs' => [
[
'id' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/crm/v3/objects/products/batch/archive');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/batch/archive' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"inputs": [
{
"id": ""
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/batch/archive' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"inputs": [
{
"id": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/crm/v3/objects/products/batch/archive", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/batch/archive"
payload = { "inputs": [{ "id": "" }] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/batch/archive"
payload <- "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/batch/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/crm/v3/objects/products/batch/archive') do |req|
req.body = "{\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/batch/archive";
let payload = json!({"inputs": (json!({"id": ""}))});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/crm/v3/objects/products/batch/archive \
--header 'content-type: application/json' \
--data '{
"inputs": [
{
"id": ""
}
]
}'
echo '{
"inputs": [
{
"id": ""
}
]
}' | \
http POST {{baseUrl}}/crm/v3/objects/products/batch/archive \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "inputs": [\n {\n "id": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/batch/archive
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["inputs": [["id": ""]]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/batch/archive")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
POST
Create a batch of products
{{baseUrl}}/crm/v3/objects/products/batch/create
BODY json
{
"inputs": [
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"objectWriteTraceId": "",
"properties": {}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/batch/create");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/crm/v3/objects/products/batch/create" {:content-type :json
:form-params {:inputs [{:associations [{:types [{:associationCategory ""
:associationTypeId 0}]
:to {:id ""}}]
:objectWriteTraceId ""
:properties {}}]}})
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/batch/create"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/batch/create"),
Content = new StringContent("{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/batch/create");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/batch/create"
payload := strings.NewReader("{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/crm/v3/objects/products/batch/create HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 332
{
"inputs": [
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"objectWriteTraceId": "",
"properties": {}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/crm/v3/objects/products/batch/create")
.setHeader("content-type", "application/json")
.setBody("{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/batch/create"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/create")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/crm/v3/objects/products/batch/create")
.header("content-type", "application/json")
.body("{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}")
.asString();
const data = JSON.stringify({
inputs: [
{
associations: [
{
types: [
{
associationCategory: '',
associationTypeId: 0
}
],
to: {
id: ''
}
}
],
objectWriteTraceId: '',
properties: {}
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/crm/v3/objects/products/batch/create');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/create',
headers: {'content-type': 'application/json'},
data: {
inputs: [
{
associations: [{types: [{associationCategory: '', associationTypeId: 0}], to: {id: ''}}],
objectWriteTraceId: '',
properties: {}
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/batch/create';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"inputs":[{"associations":[{"types":[{"associationCategory":"","associationTypeId":0}],"to":{"id":""}}],"objectWriteTraceId":"","properties":{}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/batch/create',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "inputs": [\n {\n "associations": [\n {\n "types": [\n {\n "associationCategory": "",\n "associationTypeId": 0\n }\n ],\n "to": {\n "id": ""\n }\n }\n ],\n "objectWriteTraceId": "",\n "properties": {}\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/create")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/batch/create',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
inputs: [
{
associations: [{types: [{associationCategory: '', associationTypeId: 0}], to: {id: ''}}],
objectWriteTraceId: '',
properties: {}
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/create',
headers: {'content-type': 'application/json'},
body: {
inputs: [
{
associations: [{types: [{associationCategory: '', associationTypeId: 0}], to: {id: ''}}],
objectWriteTraceId: '',
properties: {}
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/crm/v3/objects/products/batch/create');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
inputs: [
{
associations: [
{
types: [
{
associationCategory: '',
associationTypeId: 0
}
],
to: {
id: ''
}
}
],
objectWriteTraceId: '',
properties: {}
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/create',
headers: {'content-type': 'application/json'},
data: {
inputs: [
{
associations: [{types: [{associationCategory: '', associationTypeId: 0}], to: {id: ''}}],
objectWriteTraceId: '',
properties: {}
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/batch/create';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"inputs":[{"associations":[{"types":[{"associationCategory":"","associationTypeId":0}],"to":{"id":""}}],"objectWriteTraceId":"","properties":{}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"inputs": @[ @{ @"associations": @[ @{ @"types": @[ @{ @"associationCategory": @"", @"associationTypeId": @0 } ], @"to": @{ @"id": @"" } } ], @"objectWriteTraceId": @"", @"properties": @{ } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/batch/create"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/batch/create" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/batch/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
[
'associations' => [
[
'types' => [
[
'associationCategory' => '',
'associationTypeId' => 0
]
],
'to' => [
'id' => ''
]
]
],
'objectWriteTraceId' => '',
'properties' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/crm/v3/objects/products/batch/create', [
'body' => '{
"inputs": [
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"objectWriteTraceId": "",
"properties": {}
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/batch/create');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'inputs' => [
[
'associations' => [
[
'types' => [
[
'associationCategory' => '',
'associationTypeId' => 0
]
],
'to' => [
'id' => ''
]
]
],
'objectWriteTraceId' => '',
'properties' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'inputs' => [
[
'associations' => [
[
'types' => [
[
'associationCategory' => '',
'associationTypeId' => 0
]
],
'to' => [
'id' => ''
]
]
],
'objectWriteTraceId' => '',
'properties' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/crm/v3/objects/products/batch/create');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/batch/create' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"inputs": [
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"objectWriteTraceId": "",
"properties": {}
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/batch/create' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"inputs": [
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"objectWriteTraceId": "",
"properties": {}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/crm/v3/objects/products/batch/create", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/batch/create"
payload = { "inputs": [
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": { "id": "" }
}
],
"objectWriteTraceId": "",
"properties": {}
}
] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/batch/create"
payload <- "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/batch/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/crm/v3/objects/products/batch/create') do |req|
req.body = "{\n \"inputs\": [\n {\n \"associations\": [\n {\n \"types\": [\n {\n \"associationCategory\": \"\",\n \"associationTypeId\": 0\n }\n ],\n \"to\": {\n \"id\": \"\"\n }\n }\n ],\n \"objectWriteTraceId\": \"\",\n \"properties\": {}\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/batch/create";
let payload = json!({"inputs": (
json!({
"associations": (
json!({
"types": (
json!({
"associationCategory": "",
"associationTypeId": 0
})
),
"to": json!({"id": ""})
})
),
"objectWriteTraceId": "",
"properties": json!({})
})
)});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/crm/v3/objects/products/batch/create \
--header 'content-type: application/json' \
--data '{
"inputs": [
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"objectWriteTraceId": "",
"properties": {}
}
]
}'
echo '{
"inputs": [
{
"associations": [
{
"types": [
{
"associationCategory": "",
"associationTypeId": 0
}
],
"to": {
"id": ""
}
}
],
"objectWriteTraceId": "",
"properties": {}
}
]
}' | \
http POST {{baseUrl}}/crm/v3/objects/products/batch/create \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "inputs": [\n {\n "associations": [\n {\n "types": [\n {\n "associationCategory": "",\n "associationTypeId": 0\n }\n ],\n "to": {\n "id": ""\n }\n }\n ],\n "objectWriteTraceId": "",\n "properties": {}\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/batch/create
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["inputs": [
[
"associations": [
[
"types": [
[
"associationCategory": "",
"associationTypeId": 0
]
],
"to": ["id": ""]
]
],
"objectWriteTraceId": "",
"properties": []
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/batch/create")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"results": [
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"results": [
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
]
}
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
POST
Create or update a batch of products by unique property values
{{baseUrl}}/crm/v3/objects/products/batch/upsert
BODY json
{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/batch/upsert");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/crm/v3/objects/products/batch/upsert" {:content-type :json
:form-params {:inputs [{:idProperty ""
:objectWriteTraceId ""
:id ""
:properties {}}]}})
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/batch/upsert"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/batch/upsert"),
Content = new StringContent("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/batch/upsert");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/batch/upsert"
payload := strings.NewReader("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/crm/v3/objects/products/batch/upsert HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 128
{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/crm/v3/objects/products/batch/upsert")
.setHeader("content-type", "application/json")
.setBody("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/batch/upsert"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/upsert")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/crm/v3/objects/products/batch/upsert")
.header("content-type", "application/json")
.body("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
.asString();
const data = JSON.stringify({
inputs: [
{
idProperty: '',
objectWriteTraceId: '',
id: '',
properties: {}
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/crm/v3/objects/products/batch/upsert');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/upsert',
headers: {'content-type': 'application/json'},
data: {inputs: [{idProperty: '', objectWriteTraceId: '', id: '', properties: {}}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/batch/upsert';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"inputs":[{"idProperty":"","objectWriteTraceId":"","id":"","properties":{}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/batch/upsert',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "inputs": [\n {\n "idProperty": "",\n "objectWriteTraceId": "",\n "id": "",\n "properties": {}\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/upsert")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/batch/upsert',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({inputs: [{idProperty: '', objectWriteTraceId: '', id: '', properties: {}}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/upsert',
headers: {'content-type': 'application/json'},
body: {inputs: [{idProperty: '', objectWriteTraceId: '', id: '', properties: {}}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/crm/v3/objects/products/batch/upsert');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
inputs: [
{
idProperty: '',
objectWriteTraceId: '',
id: '',
properties: {}
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/upsert',
headers: {'content-type': 'application/json'},
data: {inputs: [{idProperty: '', objectWriteTraceId: '', id: '', properties: {}}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/batch/upsert';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"inputs":[{"idProperty":"","objectWriteTraceId":"","id":"","properties":{}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"inputs": @[ @{ @"idProperty": @"", @"objectWriteTraceId": @"", @"id": @"", @"properties": @{ } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/batch/upsert"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/batch/upsert" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/batch/upsert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
[
'idProperty' => '',
'objectWriteTraceId' => '',
'id' => '',
'properties' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/crm/v3/objects/products/batch/upsert', [
'body' => '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/batch/upsert');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'inputs' => [
[
'idProperty' => '',
'objectWriteTraceId' => '',
'id' => '',
'properties' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'inputs' => [
[
'idProperty' => '',
'objectWriteTraceId' => '',
'id' => '',
'properties' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/crm/v3/objects/products/batch/upsert');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/batch/upsert' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/batch/upsert' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/crm/v3/objects/products/batch/upsert", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/batch/upsert"
payload = { "inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/batch/upsert"
payload <- "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/batch/upsert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/crm/v3/objects/products/batch/upsert') do |req|
req.body = "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/batch/upsert";
let payload = json!({"inputs": (
json!({
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": json!({})
})
)});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/crm/v3/objects/products/batch/upsert \
--header 'content-type: application/json' \
--data '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}'
echo '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}' | \
http POST {{baseUrl}}/crm/v3/objects/products/batch/upsert \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "inputs": [\n {\n "idProperty": "",\n "objectWriteTraceId": "",\n "id": "",\n "properties": {}\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/batch/upsert
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["inputs": [
[
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": []
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/batch/upsert")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
POST
Read a batch of products by internal ID, or unique property values
{{baseUrl}}/crm/v3/objects/products/batch/read
BODY json
{
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [
{
"id": ""
}
],
"properties": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/batch/read");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/crm/v3/objects/products/batch/read" {:content-type :json
:form-params {:propertiesWithHistory []
:idProperty ""
:inputs [{:id ""}]
:properties []}})
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/batch/read"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/batch/read"),
Content = new StringContent("{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/batch/read");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/batch/read"
payload := strings.NewReader("{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/crm/v3/objects/products/batch/read HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 119
{
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [
{
"id": ""
}
],
"properties": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/crm/v3/objects/products/batch/read")
.setHeader("content-type", "application/json")
.setBody("{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/batch/read"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/read")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/crm/v3/objects/products/batch/read")
.header("content-type", "application/json")
.body("{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}")
.asString();
const data = JSON.stringify({
propertiesWithHistory: [],
idProperty: '',
inputs: [
{
id: ''
}
],
properties: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/crm/v3/objects/products/batch/read');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/read',
headers: {'content-type': 'application/json'},
data: {propertiesWithHistory: [], idProperty: '', inputs: [{id: ''}], properties: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/batch/read';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"propertiesWithHistory":[],"idProperty":"","inputs":[{"id":""}],"properties":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/batch/read',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "propertiesWithHistory": [],\n "idProperty": "",\n "inputs": [\n {\n "id": ""\n }\n ],\n "properties": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/read")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/batch/read',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({propertiesWithHistory: [], idProperty: '', inputs: [{id: ''}], properties: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/read',
headers: {'content-type': 'application/json'},
body: {propertiesWithHistory: [], idProperty: '', inputs: [{id: ''}], properties: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/crm/v3/objects/products/batch/read');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
propertiesWithHistory: [],
idProperty: '',
inputs: [
{
id: ''
}
],
properties: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/read',
headers: {'content-type': 'application/json'},
data: {propertiesWithHistory: [], idProperty: '', inputs: [{id: ''}], properties: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/batch/read';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"propertiesWithHistory":[],"idProperty":"","inputs":[{"id":""}],"properties":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"propertiesWithHistory": @[ ],
@"idProperty": @"",
@"inputs": @[ @{ @"id": @"" } ],
@"properties": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/batch/read"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/batch/read" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/batch/read",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'propertiesWithHistory' => [
],
'idProperty' => '',
'inputs' => [
[
'id' => ''
]
],
'properties' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/crm/v3/objects/products/batch/read', [
'body' => '{
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [
{
"id": ""
}
],
"properties": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/batch/read');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'propertiesWithHistory' => [
],
'idProperty' => '',
'inputs' => [
[
'id' => ''
]
],
'properties' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'propertiesWithHistory' => [
],
'idProperty' => '',
'inputs' => [
[
'id' => ''
]
],
'properties' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/crm/v3/objects/products/batch/read');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/batch/read' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [
{
"id": ""
}
],
"properties": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/batch/read' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [
{
"id": ""
}
],
"properties": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/crm/v3/objects/products/batch/read", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/batch/read"
payload = {
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [{ "id": "" }],
"properties": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/batch/read"
payload <- "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/batch/read")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/crm/v3/objects/products/batch/read') do |req|
req.body = "{\n \"propertiesWithHistory\": [],\n \"idProperty\": \"\",\n \"inputs\": [\n {\n \"id\": \"\"\n }\n ],\n \"properties\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/batch/read";
let payload = json!({
"propertiesWithHistory": (),
"idProperty": "",
"inputs": (json!({"id": ""})),
"properties": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/crm/v3/objects/products/batch/read \
--header 'content-type: application/json' \
--data '{
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [
{
"id": ""
}
],
"properties": []
}'
echo '{
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [
{
"id": ""
}
],
"properties": []
}' | \
http POST {{baseUrl}}/crm/v3/objects/products/batch/read \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "propertiesWithHistory": [],\n "idProperty": "",\n "inputs": [\n {\n "id": ""\n }\n ],\n "properties": []\n}' \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/batch/read
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"propertiesWithHistory": [],
"idProperty": "",
"inputs": [["id": ""]],
"properties": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/batch/read")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"results": [
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"results": [
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
]
}
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
POST
Update a batch of products by internal ID, or unique property values
{{baseUrl}}/crm/v3/objects/products/batch/update
BODY json
{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/batch/update");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/crm/v3/objects/products/batch/update" {:content-type :json
:form-params {:inputs [{:idProperty ""
:objectWriteTraceId ""
:id ""
:properties {}}]}})
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/batch/update"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/batch/update"),
Content = new StringContent("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/batch/update");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/batch/update"
payload := strings.NewReader("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/crm/v3/objects/products/batch/update HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 128
{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/crm/v3/objects/products/batch/update")
.setHeader("content-type", "application/json")
.setBody("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/batch/update"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/update")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/crm/v3/objects/products/batch/update")
.header("content-type", "application/json")
.body("{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
.asString();
const data = JSON.stringify({
inputs: [
{
idProperty: '',
objectWriteTraceId: '',
id: '',
properties: {}
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/crm/v3/objects/products/batch/update');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/update',
headers: {'content-type': 'application/json'},
data: {inputs: [{idProperty: '', objectWriteTraceId: '', id: '', properties: {}}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/batch/update';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"inputs":[{"idProperty":"","objectWriteTraceId":"","id":"","properties":{}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/batch/update',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "inputs": [\n {\n "idProperty": "",\n "objectWriteTraceId": "",\n "id": "",\n "properties": {}\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/batch/update")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/batch/update',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({inputs: [{idProperty: '', objectWriteTraceId: '', id: '', properties: {}}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/update',
headers: {'content-type': 'application/json'},
body: {inputs: [{idProperty: '', objectWriteTraceId: '', id: '', properties: {}}]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/crm/v3/objects/products/batch/update');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
inputs: [
{
idProperty: '',
objectWriteTraceId: '',
id: '',
properties: {}
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/batch/update',
headers: {'content-type': 'application/json'},
data: {inputs: [{idProperty: '', objectWriteTraceId: '', id: '', properties: {}}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/batch/update';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"inputs":[{"idProperty":"","objectWriteTraceId":"","id":"","properties":{}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"inputs": @[ @{ @"idProperty": @"", @"objectWriteTraceId": @"", @"id": @"", @"properties": @{ } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/batch/update"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/batch/update" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/batch/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inputs' => [
[
'idProperty' => '',
'objectWriteTraceId' => '',
'id' => '',
'properties' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/crm/v3/objects/products/batch/update', [
'body' => '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/batch/update');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'inputs' => [
[
'idProperty' => '',
'objectWriteTraceId' => '',
'id' => '',
'properties' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'inputs' => [
[
'idProperty' => '',
'objectWriteTraceId' => '',
'id' => '',
'properties' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/crm/v3/objects/products/batch/update');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/batch/update' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/batch/update' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/crm/v3/objects/products/batch/update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/batch/update"
payload = { "inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/batch/update"
payload <- "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/batch/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/crm/v3/objects/products/batch/update') do |req|
req.body = "{\n \"inputs\": [\n {\n \"idProperty\": \"\",\n \"objectWriteTraceId\": \"\",\n \"id\": \"\",\n \"properties\": {}\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/batch/update";
let payload = json!({"inputs": (
json!({
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": json!({})
})
)});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/crm/v3/objects/products/batch/update \
--header 'content-type: application/json' \
--data '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}'
echo '{
"inputs": [
{
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": {}
}
]
}' | \
http POST {{baseUrl}}/crm/v3/objects/products/batch/update \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "inputs": [\n {\n "idProperty": "",\n "objectWriteTraceId": "",\n "id": "",\n "properties": {}\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/batch/update
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["inputs": [
[
"idProperty": "",
"objectWriteTraceId": "",
"id": "",
"properties": []
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/batch/update")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"results": [
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"results": [
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
]
}
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}
POST
post--crm-v3-objects-products-search_doSearch
{{baseUrl}}/crm/v3/objects/products/search
BODY json
{
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [
{
"filters": [
{
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
}
]
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/crm/v3/objects/products/search");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/crm/v3/objects/products/search" {:content-type :json
:form-params {:query ""
:limit 0
:after ""
:sorts []
:properties []
:filterGroups [{:filters [{:highValue ""
:propertyName ""
:values []
:value ""
:operator ""}]}]}})
require "http/client"
url = "{{baseUrl}}/crm/v3/objects/products/search"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/crm/v3/objects/products/search"),
Content = new StringContent("{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/crm/v3/objects/products/search");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/crm/v3/objects/products/search"
payload := strings.NewReader("{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/crm/v3/objects/products/search HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 294
{
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [
{
"filters": [
{
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
}
]
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/crm/v3/objects/products/search")
.setHeader("content-type", "application/json")
.setBody("{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/crm/v3/objects/products/search"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/search")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/crm/v3/objects/products/search")
.header("content-type", "application/json")
.body("{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}")
.asString();
const data = JSON.stringify({
query: '',
limit: 0,
after: '',
sorts: [],
properties: [],
filterGroups: [
{
filters: [
{
highValue: '',
propertyName: '',
values: [],
value: '',
operator: ''
}
]
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/crm/v3/objects/products/search');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/search',
headers: {'content-type': 'application/json'},
data: {
query: '',
limit: 0,
after: '',
sorts: [],
properties: [],
filterGroups: [
{
filters: [{highValue: '', propertyName: '', values: [], value: '', operator: ''}]
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/crm/v3/objects/products/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"query":"","limit":0,"after":"","sorts":[],"properties":[],"filterGroups":[{"filters":[{"highValue":"","propertyName":"","values":[],"value":"","operator":""}]}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/crm/v3/objects/products/search',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "query": "",\n "limit": 0,\n "after": "",\n "sorts": [],\n "properties": [],\n "filterGroups": [\n {\n "filters": [\n {\n "highValue": "",\n "propertyName": "",\n "values": [],\n "value": "",\n "operator": ""\n }\n ]\n }\n ]\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/crm/v3/objects/products/search")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/crm/v3/objects/products/search',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
query: '',
limit: 0,
after: '',
sorts: [],
properties: [],
filterGroups: [
{
filters: [{highValue: '', propertyName: '', values: [], value: '', operator: ''}]
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/search',
headers: {'content-type': 'application/json'},
body: {
query: '',
limit: 0,
after: '',
sorts: [],
properties: [],
filterGroups: [
{
filters: [{highValue: '', propertyName: '', values: [], value: '', operator: ''}]
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/crm/v3/objects/products/search');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
query: '',
limit: 0,
after: '',
sorts: [],
properties: [],
filterGroups: [
{
filters: [
{
highValue: '',
propertyName: '',
values: [],
value: '',
operator: ''
}
]
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/crm/v3/objects/products/search',
headers: {'content-type': 'application/json'},
data: {
query: '',
limit: 0,
after: '',
sorts: [],
properties: [],
filterGroups: [
{
filters: [{highValue: '', propertyName: '', values: [], value: '', operator: ''}]
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/crm/v3/objects/products/search';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"query":"","limit":0,"after":"","sorts":[],"properties":[],"filterGroups":[{"filters":[{"highValue":"","propertyName":"","values":[],"value":"","operator":""}]}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"query": @"",
@"limit": @0,
@"after": @"",
@"sorts": @[ ],
@"properties": @[ ],
@"filterGroups": @[ @{ @"filters": @[ @{ @"highValue": @"", @"propertyName": @"", @"values": @[ ], @"value": @"", @"operator": @"" } ] } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/crm/v3/objects/products/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/crm/v3/objects/products/search" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/crm/v3/objects/products/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '',
'limit' => 0,
'after' => '',
'sorts' => [
],
'properties' => [
],
'filterGroups' => [
[
'filters' => [
[
'highValue' => '',
'propertyName' => '',
'values' => [
],
'value' => '',
'operator' => ''
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/crm/v3/objects/products/search', [
'body' => '{
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [
{
"filters": [
{
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
}
]
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/crm/v3/objects/products/search');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'query' => '',
'limit' => 0,
'after' => '',
'sorts' => [
],
'properties' => [
],
'filterGroups' => [
[
'filters' => [
[
'highValue' => '',
'propertyName' => '',
'values' => [
],
'value' => '',
'operator' => ''
]
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'query' => '',
'limit' => 0,
'after' => '',
'sorts' => [
],
'properties' => [
],
'filterGroups' => [
[
'filters' => [
[
'highValue' => '',
'propertyName' => '',
'values' => [
],
'value' => '',
'operator' => ''
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/crm/v3/objects/products/search');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/crm/v3/objects/products/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [
{
"filters": [
{
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
}
]
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/crm/v3/objects/products/search' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [
{
"filters": [
{
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
}
]
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/crm/v3/objects/products/search", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/crm/v3/objects/products/search"
payload = {
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [{ "filters": [
{
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
}
] }]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/crm/v3/objects/products/search"
payload <- "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/crm/v3/objects/products/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/crm/v3/objects/products/search') do |req|
req.body = "{\n \"query\": \"\",\n \"limit\": 0,\n \"after\": \"\",\n \"sorts\": [],\n \"properties\": [],\n \"filterGroups\": [\n {\n \"filters\": [\n {\n \"highValue\": \"\",\n \"propertyName\": \"\",\n \"values\": [],\n \"value\": \"\",\n \"operator\": \"\"\n }\n ]\n }\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/crm/v3/objects/products/search";
let payload = json!({
"query": "",
"limit": 0,
"after": "",
"sorts": (),
"properties": (),
"filterGroups": (json!({"filters": (
json!({
"highValue": "",
"propertyName": "",
"values": (),
"value": "",
"operator": ""
})
)}))
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/crm/v3/objects/products/search \
--header 'content-type: application/json' \
--data '{
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [
{
"filters": [
{
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
}
]
}
]
}'
echo '{
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [
{
"filters": [
{
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
}
]
}
]
}' | \
http POST {{baseUrl}}/crm/v3/objects/products/search \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "query": "",\n "limit": 0,\n "after": "",\n "sorts": [],\n "properties": [],\n "filterGroups": [\n {\n "filters": [\n {\n "highValue": "",\n "propertyName": "",\n "values": [],\n "value": "",\n "operator": ""\n }\n ]\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/crm/v3/objects/products/search
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"query": "",
"limit": 0,
"after": "",
"sorts": [],
"properties": [],
"filterGroups": [["filters": [
[
"highValue": "",
"propertyName": "",
"values": [],
"value": "",
"operator": ""
]
]]]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/crm/v3/objects/products/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"paging": {
"next": {
"after": "NTI1Cg%3D%3D",
"link": "?after=NTI1Cg%3D%3D"
}
},
"results": [
{
"archived": false,
"createdAt": "2019-10-30T03:30:17.883Z",
"id": "512",
"properties": {
"createdate": "2019-10-30T03:30:17.883Z",
"description": "Onboarding service for data product",
"hs_cost_of_goods_sold": "600.00",
"hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
"hs_recurring_billing_period": "12",
"hs_sku": "191902",
"name": "Implementation Service ",
"price": "6000.00"
},
"updatedAt": "2019-12-07T16:50:06.678Z"
}
]
}
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"message": "Invalid input (details will vary based on the error)",
"correlationId": "aeb5f871-7f07-4993-9211-075dc63e7cbf",
"category": "VALIDATION_ERROR",
"links": {
"knowledge-base": "https://www.hubspot.com/products/service/knowledge-base"
}
}