CreateRepository
Creates a source control repository.
The creation of the resource will be an upsert operation if the given spec.external_id and spec.platform_resource are already available.
curl --request POST \
--url https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories \
--header 'Content-Type: application/json' \
--data '
{
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"meta": {
"name": "<string>",
"annotations": {},
"description": "<string>",
"index_data": {},
"parent_kind": "<string>",
"parent_uuid": "<string>",
"tags": [
"<string>"
]
},
"tenant_meta": {}
}
'import requests
url = "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories"
payload = {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"meta": {
"name": "<string>",
"annotations": {},
"description": "<string>",
"index_data": {},
"parent_kind": "<string>",
"parent_uuid": "<string>",
"tags": ["<string>"]
},
"tenant_meta": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
ingested_object: {
ingestion_time: '2023-11-07T05:31:56Z',
raw: {},
status: 'INGESTED_OBJECT_STATUS_UNSPECIFIED'
},
meta: {
name: '<string>',
annotations: {},
description: '<string>',
index_data: {},
parent_kind: '<string>',
parent_uuid: '<string>',
tags: ['<string>']
},
tenant_meta: {}
})
};
fetch('https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories', 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://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories",
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([
'ingested_object' => [
'ingestion_time' => '2023-11-07T05:31:56Z',
'raw' => [
],
'status' => 'INGESTED_OBJECT_STATUS_UNSPECIFIED'
],
'meta' => [
'name' => '<string>',
'annotations' => [
],
'description' => '<string>',
'index_data' => [
],
'parent_kind' => '<string>',
'parent_uuid' => '<string>',
'tags' => [
'<string>'
]
],
'tenant_meta' => [
]
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories"
payload := strings.NewReader("{\n \"ingested_object\": {\n \"ingestion_time\": \"2023-11-07T05:31:56Z\",\n \"raw\": {},\n \"status\": \"INGESTED_OBJECT_STATUS_UNSPECIFIED\"\n },\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"tenant_meta\": {}\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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories")
.header("Content-Type", "application/json")
.body("{\n \"ingested_object\": {\n \"ingestion_time\": \"2023-11-07T05:31:56Z\",\n \"raw\": {},\n \"status\": \"INGESTED_OBJECT_STATUS_UNSPECIFIED\"\n },\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"tenant_meta\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories")
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 \"ingested_object\": {\n \"ingestion_time\": \"2023-11-07T05:31:56Z\",\n \"raw\": {},\n \"status\": \"INGESTED_OBJECT_STATUS_UNSPECIFIED\"\n },\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"tenant_meta\": {}\n}"
response = http.request(request)
puts response.read_body{
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"meta": {
"name": "<string>",
"annotations": {},
"create_time": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"index_data": {
"data": [
"<string>"
],
"search_score": 123,
"tenant": "<string>",
"will_be_deleted_at": "2023-11-07T05:31:56Z"
},
"kind": "<string>",
"parent_kind": "<string>",
"parent_uuid": "<string>",
"references": {},
"tags": [
"<string>"
],
"update_time": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"upsert_time": "2023-11-07T05:31:56Z",
"version": "<string>"
},
"spec": {
"default_branch": "<string>",
"http_clone_url": "<string>",
"platform_source": "PLATFORM_SOURCE_UNSPECIFIED",
"branch_protections": {},
"commit_hashes": [
"<string>"
],
"contributors": [
"<string>"
],
"create_time": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"languages": {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
}
},
"org": {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
}
},
"owner": {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"meta": {
"name": "<string>",
"annotations": {},
"create_time": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"index_data": {
"data": [
"<string>"
],
"search_score": 123,
"tenant": "<string>",
"will_be_deleted_at": "2023-11-07T05:31:56Z"
},
"kind": "<string>",
"parent_kind": "<string>",
"parent_uuid": "<string>",
"references": {},
"tags": [
"<string>"
],
"update_time": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"upsert_time": "2023-11-07T05:31:56Z",
"version": "<string>"
},
"spec": {
"external_id": "<string>",
"platform_source": "PLATFORM_SOURCE_UNSPECIFIED",
"create_time": "2023-11-07T05:31:56Z",
"email": "<string>",
"name": "<string>",
"update_time": "2023-11-07T05:31:56Z"
},
"tenant_meta": {
"namespace": "<string>"
},
"uuid": "<string>"
},
"repository_license": {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"name": "<string>"
},
"tags": [
{
"commit_date": "2023-11-07T05:31:56Z",
"name": "<string>",
"sha": "<string>"
}
],
"update_time": "2023-11-07T05:31:56Z",
"vulnerability_alerts_enabled": true
},
"tenant_meta": {
"namespace": "<string>"
},
"uuid": "<string>"
}{
"code": 123,
"details": [
{
"@type": "<string>"
}
],
"message": "<string>"
}Path Parameters
Namespaces are a way to organize organizational units into virtual groupings of resources. Namespaces must be a fully qualified name, for example, the child namespace of namespace "endor.prod" called "app" is called "endor.prod.app".
Body
Repository represents the ingested information about a source control repository. A repository may refer to any type of source control repository, such as GitLab or GitHub.
Raw ingested object from a 3rd party source, along with any additional metadata we want to add to the object.
Show child attributes
Show child attributes
Common fields for all Endor Labs resources.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Repositories are associated with a tenant. Public repositories are created as repositories under a public tenant.
Response
A successful response.
Repository represents the ingested information about a source control repository. A repository may refer to any type of source control repository, such as GitLab or GitHub.
Raw ingested object from a 3rd party source, along with any additional metadata we want to add to the object.
Show child attributes
Show child attributes
Common fields for all Endor Labs resources.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Tenant related data for the tenant containing the resource.
Show child attributes
Show child attributes
The UUID of the source control repository.
Was this page helpful?
curl --request POST \
--url https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories \
--header 'Content-Type: application/json' \
--data '
{
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"meta": {
"name": "<string>",
"annotations": {},
"description": "<string>",
"index_data": {},
"parent_kind": "<string>",
"parent_uuid": "<string>",
"tags": [
"<string>"
]
},
"tenant_meta": {}
}
'import requests
url = "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories"
payload = {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"meta": {
"name": "<string>",
"annotations": {},
"description": "<string>",
"index_data": {},
"parent_kind": "<string>",
"parent_uuid": "<string>",
"tags": ["<string>"]
},
"tenant_meta": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
ingested_object: {
ingestion_time: '2023-11-07T05:31:56Z',
raw: {},
status: 'INGESTED_OBJECT_STATUS_UNSPECIFIED'
},
meta: {
name: '<string>',
annotations: {},
description: '<string>',
index_data: {},
parent_kind: '<string>',
parent_uuid: '<string>',
tags: ['<string>']
},
tenant_meta: {}
})
};
fetch('https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories', 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://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories",
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([
'ingested_object' => [
'ingestion_time' => '2023-11-07T05:31:56Z',
'raw' => [
],
'status' => 'INGESTED_OBJECT_STATUS_UNSPECIFIED'
],
'meta' => [
'name' => '<string>',
'annotations' => [
],
'description' => '<string>',
'index_data' => [
],
'parent_kind' => '<string>',
'parent_uuid' => '<string>',
'tags' => [
'<string>'
]
],
'tenant_meta' => [
]
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories"
payload := strings.NewReader("{\n \"ingested_object\": {\n \"ingestion_time\": \"2023-11-07T05:31:56Z\",\n \"raw\": {},\n \"status\": \"INGESTED_OBJECT_STATUS_UNSPECIFIED\"\n },\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"tenant_meta\": {}\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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories")
.header("Content-Type", "application/json")
.body("{\n \"ingested_object\": {\n \"ingestion_time\": \"2023-11-07T05:31:56Z\",\n \"raw\": {},\n \"status\": \"INGESTED_OBJECT_STATUS_UNSPECIFIED\"\n },\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"tenant_meta\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/repositories")
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 \"ingested_object\": {\n \"ingestion_time\": \"2023-11-07T05:31:56Z\",\n \"raw\": {},\n \"status\": \"INGESTED_OBJECT_STATUS_UNSPECIFIED\"\n },\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"tenant_meta\": {}\n}"
response = http.request(request)
puts response.read_body{
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"meta": {
"name": "<string>",
"annotations": {},
"create_time": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"index_data": {
"data": [
"<string>"
],
"search_score": 123,
"tenant": "<string>",
"will_be_deleted_at": "2023-11-07T05:31:56Z"
},
"kind": "<string>",
"parent_kind": "<string>",
"parent_uuid": "<string>",
"references": {},
"tags": [
"<string>"
],
"update_time": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"upsert_time": "2023-11-07T05:31:56Z",
"version": "<string>"
},
"spec": {
"default_branch": "<string>",
"http_clone_url": "<string>",
"platform_source": "PLATFORM_SOURCE_UNSPECIFIED",
"branch_protections": {},
"commit_hashes": [
"<string>"
],
"contributors": [
"<string>"
],
"create_time": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"languages": {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
}
},
"org": {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
}
},
"owner": {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"meta": {
"name": "<string>",
"annotations": {},
"create_time": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"index_data": {
"data": [
"<string>"
],
"search_score": 123,
"tenant": "<string>",
"will_be_deleted_at": "2023-11-07T05:31:56Z"
},
"kind": "<string>",
"parent_kind": "<string>",
"parent_uuid": "<string>",
"references": {},
"tags": [
"<string>"
],
"update_time": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"upsert_time": "2023-11-07T05:31:56Z",
"version": "<string>"
},
"spec": {
"external_id": "<string>",
"platform_source": "PLATFORM_SOURCE_UNSPECIFIED",
"create_time": "2023-11-07T05:31:56Z",
"email": "<string>",
"name": "<string>",
"update_time": "2023-11-07T05:31:56Z"
},
"tenant_meta": {
"namespace": "<string>"
},
"uuid": "<string>"
},
"repository_license": {
"ingested_object": {
"ingestion_time": "2023-11-07T05:31:56Z",
"raw": {},
"status": "INGESTED_OBJECT_STATUS_UNSPECIFIED"
},
"name": "<string>"
},
"tags": [
{
"commit_date": "2023-11-07T05:31:56Z",
"name": "<string>",
"sha": "<string>"
}
],
"update_time": "2023-11-07T05:31:56Z",
"vulnerability_alerts_enabled": true
},
"tenant_meta": {
"namespace": "<string>"
},
"uuid": "<string>"
}{
"code": 123,
"details": [
{
"@type": "<string>"
}
],
"message": "<string>"
}