Check whether a CID exists
Reports whether the blob store holds a blob under the CID. Requires view_project_data in at least one project.
get
https://<host>/store/v1/exists/{cid}bash
curl --request GET \
--url 'https://<host>/store/v1/exists/{cid}' \
--header 'Authorization: Bearer <token>'javascript
const response = await fetch("https://<host>/store/v1/exists/{cid}", {
method: "GET",
headers: {
"Authorization": "Bearer <token>"
}
});
const data = await response.json();typescript
interface ExistsResponse {
exists: boolean;
}
const response = await fetch("https://<host>/store/v1/exists/{cid}", {
method: "GET",
headers: {
"Authorization": "Bearer <token>"
}
});
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
const data: ExistsResponse = await response.json();python
import requests
response = requests.get(
"https://<host>/store/v1/exists/{cid}",
headers={
"Authorization": "Bearer <token>",
},
)
response.raise_for_status()
print(response.json())go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest(http.MethodGet, "https://<host>/store/v1/exists/{cid}", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <token>")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status, string(data))
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://<host>/store/v1/exists/{cid}"))
.header("Authorization", "Bearer <token>")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}csharp
using System.Net.Http.Headers;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://<host>/store/v1/exists/{cid}");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "<token>");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");php
<?php
$ch = curl_init('https://<host>/store/v1/exists/{cid}');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status . " " . $response . PHP_EOL;ruby
require "net/http"
uri = URI("https://<host>/store/v1/exists/{cid}")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer <token>"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts "#{response.code} #{response.body}"rust
// Cargo.toml dependencies: reqwest, tokio (features "full")
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::Client::new()
.get("https://<host>/store/v1/exists/{cid}")
.header("Authorization", "Bearer <token>")
.send()
.await?;
println!("{} {}", response.status(), response.text().await?);
Ok(())
}Authorizations
BearerAuth· HTTP bearer (JWT)
Parameters
Path parameters
| Name | Type | Description |
|---|---|---|
cidrequired | string | CID to check; a urn:cid: prefix is accepted |
Responses
200Whether the blob store holds the CID
application/json
existsbooleanrequired
Examplejson
{
"exists": true
}401Missing or invalid bearer token
application/json
callstackobjectShow properties
object | nullerrorstringrequired
Examplejson
{
"callstack": {},
"error": "string"
}403Caller holds view_project_data in no project
application/json
callstackobjectShow properties
object | nullerrorstringrequired
Examplejson
{
"callstack": {},
"error": "string"
}500Internal error
application/json
callstackobjectShow properties
object | nullerrorstringrequired
Examplejson
{
"callstack": {},
"error": "string"
}503Auth Service or blob storage unavailable
application/json
callstackobjectShow properties
object | nullerrorstringrequired
Examplejson
{
"callstack": {},
"error": "string"
}