Add resources to project
curl --request POST \
--url https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"resources": [
{
"resource_type": "job",
"resource_id": "48421e16-1f50-4048-b62c-d3bc0789d30d"
}
]
}
'import requests
url = "https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources"
payload = { "resources": [
{
"resource_type": "job",
"resource_id": "48421e16-1f50-4048-b62c-d3bc0789d30d"
}
] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
resources: [{resource_type: 'job', resource_id: '48421e16-1f50-4048-b62c-d3bc0789d30d'}]
})
};
fetch('https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources",
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([
'resources' => [
[
'resource_type' => 'job',
'resource_id' => '48421e16-1f50-4048-b62c-d3bc0789d30d'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources"
payload := strings.NewReader("{\n \"resources\": [\n {\n \"resource_type\": \"job\",\n \"resource_id\": \"48421e16-1f50-4048-b62c-d3bc0789d30d\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"resources\": [\n {\n \"resource_type\": \"job\",\n \"resource_id\": \"48421e16-1f50-4048-b62c-d3bc0789d30d\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"resources\": [\n {\n \"resource_type\": \"job\",\n \"resource_id\": \"48421e16-1f50-4048-b62c-d3bc0789d30d\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Resources added to project.",
"results": [
{
"resource_type": "job",
"resource_id": "48421e16-1f50-4048-b62c-d3bc0789d30d",
"success": true,
"message": "Resource added to project.",
"already_exists": false
}
]
}Projects
Add resources to project
Assigns one or more existing resources to a project in a single request.
POST
/
catchAll
/
projects
/
{project_id}
/
resources
Add resources to project
curl --request POST \
--url https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"resources": [
{
"resource_type": "job",
"resource_id": "48421e16-1f50-4048-b62c-d3bc0789d30d"
}
]
}
'import requests
url = "https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources"
payload = { "resources": [
{
"resource_type": "job",
"resource_id": "48421e16-1f50-4048-b62c-d3bc0789d30d"
}
] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
resources: [{resource_type: 'job', resource_id: '48421e16-1f50-4048-b62c-d3bc0789d30d'}]
})
};
fetch('https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources",
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([
'resources' => [
[
'resource_type' => 'job',
'resource_id' => '48421e16-1f50-4048-b62c-d3bc0789d30d'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources"
payload := strings.NewReader("{\n \"resources\": [\n {\n \"resource_type\": \"job\",\n \"resource_id\": \"48421e16-1f50-4048-b62c-d3bc0789d30d\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"resources\": [\n {\n \"resource_type\": \"job\",\n \"resource_id\": \"48421e16-1f50-4048-b62c-d3bc0789d30d\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://catchall.newscatcherapi.com/catchAll/projects/{project_id}/resources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"resources\": [\n {\n \"resource_type\": \"job\",\n \"resource_id\": \"48421e16-1f50-4048-b62c-d3bc0789d30d\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Resources added to project.",
"results": [
{
"resource_type": "job",
"resource_id": "48421e16-1f50-4048-b62c-d3bc0789d30d",
"success": true,
"message": "Resource added to project.",
"already_exists": false
}
]
}Authorizations
API key for authentication.
Path Parameters
Unique project identifier.
Body
application/json
Resources to assign to the project.
Minimum array length:
1Show child attributes
Show child attributes
Response
One or more resources added to the project (201), or all were already present (200).
Was this page helpful?
⌘I

