Skip to main content
POST
/
blocked_dates
Create a blocked date
curl --request POST \
  --url https://app.supercycle.com/api/v1/blocked_dates \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "resourceId": 123,
  "from": "2023-12-25",
  "to": "2023-12-25",
  "description": "<string>"
}
'
import requests

url = "https://app.supercycle.com/api/v1/blocked_dates"

payload = {
"resourceId": 123,
"from": "2023-12-25",
"to": "2023-12-25",
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({resourceId: 123, from: '2023-12-25', to: '2023-12-25', description: '<string>'})
};

fetch('https://app.supercycle.com/api/v1/blocked_dates', 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://app.supercycle.com/api/v1/blocked_dates",
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([
'resourceId' => 123,
'from' => '2023-12-25',
'to' => '2023-12-25',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://app.supercycle.com/api/v1/blocked_dates"

payload := strings.NewReader("{\n \"resourceId\": 123,\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"description\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
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://app.supercycle.com/api/v1/blocked_dates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"resourceId\": 123,\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"description\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.supercycle.com/api/v1/blocked_dates")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"resourceId\": 123,\n \"from\": \"2023-12-25\",\n \"to\": \"2023-12-25\",\n \"description\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "from": "2023-12-25",
  "resourceId": 123,
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "resource": {
    "id": 123,
    "title": "<string>",
    "formattedId": "<string>",
    "imageUrl": "<string>",
    "shopifyVariantId": 123,
    "shopifyProductId": 123,
    "shopifyDomain": "<string>"
  },
  "description": "<string>",
  "to": "2023-12-25"
}
{
"error": "Resource not found"
}
{
"errors": [
"Invalid request body"
]
}
{
"error": "Rate limit exceeded. Retry after 42 seconds."
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
resourceType
enum<string>
required

Type of resource the blocked dates apply to. Use Shop to block every product in the store.

Available options:
Item,
Shopify::Variant,
Shopify::Product,
Shop
resourceId
integer<int64>
required

Numeric ID of the blocked resource in Supercycle.

from
null | string<date>

First blocked calendar day (inclusive). Omit or null for an open-start block.

to
null | string<date>

Last blocked calendar day (inclusive). Omit or null for an open-ended block.

description
null | string

Optional note describing why the dates are blocked.

Response

Blocked date created successfully

id
integer<int64>
required

Numeric ID of the blocked date.

from
null | string<date>
required

First blocked calendar day (inclusive). Null when the block is open-start.

resourceType
enum<string>
required

Type of resource the blocked dates apply to. Use Shop to block every product in the store.

Available options:
Item,
Shopify::Variant,
Shopify::Product,
Shop
resourceId
integer<int64>
required

Numeric ID of the blocked resource in Supercycle.

createdAt
string<date-time>
required

When the blocked date was created.

updatedAt
string<date-time>
required

When the blocked date was last updated.

resource
object
required
description
null | string

Optional note describing why the dates are blocked.

to
null | string<date>

Last blocked calendar day (inclusive). Null when the block is open-ended.