Bloqifi RESTful API documentation
  • The Next Generation Web³
  • Quick Start
  • Blog
  • Reference
    • API Reference
      • Authentication
      • Bloq
      • Payment
      • Transaction
      • Rates
    • Retrieval
      • Transaction ID
      • Web
      • Blob
      • Chunk
  • Stripe Metered Billing
    • API Reference
      • Subscribe
      • Check Usage
Powered by GitBook
On this page
  • Fetch website from blockchain
  • Retrieve website
  • Fetch website from IPFS
  • Retrieve website
  • Configure a custom domain name for your IPFS

Was this helpful?

  1. Reference
  2. Retrieval

Web

Making an call to the web endpoint

Fetch website from blockchain

Retrieve a website based on the blockchain and transaction id's (txid) provided.

Retrieve website

POST https://api.bloqifi.com/v0/web

Retrieve a website

Headers

Name
Type
Description

Content-Type*

String

application/json

Request Body

Name
Type
Description

txids*

Array

List of transaction id's ['123', '321']

blockchain*

String

Bloqcoin, Dogecoin, Bitcoin

Brotli compressed data if there is Content-Encoding support, otherwise raw text/html

text/html

The web endpoint will take all the transaction ids provided, merge the received hex strings containing OP_RETURN together and combine these into the final content. Bloqcoin is the obvious choice, as it supports 102480; //!< bytes (+1 for OP_RETURN, +2 for the pushdata opcodes). And as such can host an entire website in one transaction id.

Take a look at how you might call this method using our official libraries, or via curl:

const rawResponse = await fetch('https://api.bloqifi.com/v0/web', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    blockchain: 'Bloqcoin',
    txids: ['123', '321']
  })
});

const data = await rawResponse.text();

if (rawResponse.status === 200) {

  // data contains the raw data
}
curl -X POST https://api.bloqifi.com/v0/web \
-H "Content-Type: application/json" \
-d '{"blockchain": "Bloqcoin", "txids": ["123", "321"]}' 

Good to know: Notice that the Blockchain used is capitalized, this is required.

In the example we will be using Bloqcoin, other supported blockchains are:

Dogecoin, Bitcoin

Let’s consider what the output of our response should look like:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>My Blockchain Website</title>
  </head>
  <body>
  	Hello World..
  </body>
</html>

If the browser or client is capable of decompressing Brotli, then a compressed version of the output is delivered as the content is already compressed in the blockchain.

Fetch website from IPFS

Retrieve a website based on the hash provided.

Retrieve website

GET https://storage.bloqifi.com/ipfs/CID

Retrieve a website

Brotli compressed data if there is Content-Encoding support, otherwise raw text/html

text/html
<!-- Directly in a browser supporting IPFS -->

ipfs://QmT1khGw2JNrQYh1XLdiZVBZHhwtwms2tKeKz4TF7UDG2Y
<!-- Using Bloqifi IPFS Gateway -->

https://storage.bloqifi.com/ipfs/QmT1khGw2JNrQYh1XLdiZVBZHhwtwms2tKeKz4TF7UDG2Y

Configure a custom domain name for your IPFS

If you'd prefer to use a friendly DNS name for your website, such as www.example.com, instead of the default DNS name. You can create a custom domain name and associate it with the DNS name.

When a client makes a request using this custom domain name, the DNS server resolves it to the DNS name for your IPFS content.

<!-- If apps and libraries force-lowercase on URIs,
you can substitute the IPFS hash for object id -->

ObjectID.storage.bloqifi.com.

Next, use your DNS service, such as your domain registrar, to create a CNAME record to route queries to your IPFS content. For more information, see the documentation for your DNS service.

PreviousTransaction IDNextBlob

Last updated 2 years ago

Was this helpful?