https://orbiter.host/orbiter.pngOfficial documentation for Orbiter Skip to content

Update Site

PUT
/sites/{siteId}

Using a siteId you can update an existing site by providing a new CID for the website content. This requires uploading the new site and the making another request with the CID.

import { PinataSDK } from "pinata-web3"

const pinata = new PinataSDK({
  pinataJwt: "",
  pinataGateway: ""
})

const keyReq = await fetch("https://api.orbiter.host/keys/upload_key", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Orbiter-API-Key": "<YOUR-API-KEY>"
  },
  body: null
})

const keyRes = await keyReq.json()
const files: File[] = [] // Get a folder of files either locally or through a front end
const upload = await pinata.upload.fileArray(files).key(keyRes.data)

const siteId = "36a7cbd9-4d48-4f4c-90f2-557299bf917f" // Can be obtains with GET /sites?domain=my=site

const updateSite = await fetch(`https://api.orbiter.host/sites/${siteId}`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Orbiter-API-Key": "<YOUR-API-KEY>"
  },
  body: JSON.stringify({
    cid: upload.IpfsHash,
  })
})

Authorizations

Parameters

Path Parameters

siteId
required
string
f20a57d0-2465-4621-a283-5b7d7c0306d3

Request Body

object
cid
string
bafybeifhp4bi22dq3cslzoana774ahxs4abaevik2zjd33645hhz2mzyia
Examples
{
"cid": "bafybeifhp4bi22dq3cslzoana774ahxs4abaevik2zjd33645hhz2mzyia"
}

Responses

200

Update Site

object
message
string
Success
Examples
{
"message": "Success"
}