getamis / qubic-docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Qubic Developer Documents

API & SDK

Introduction

Creator Admin API、Pass Admin API 以及 Creator Storefront API 要透過 key/secret 取得使用權限,需於通訊時在 header 中加入指定的屬性以完成驗證,描述如下:

header 屬性 類型 說明 如何取得
x-qubic-api-key string API KEY 聯絡 Qubic 團隊
x-qubic-ts string 運算當下的時間戳記 Date.now().toString()
x-qubic-sign string 運算後的簽名 範例
Authorization string 選填,使用 Storefront API 存取授權資料時,需要提供此資訊 範例

Example

基於 API 類型及安全性的要求,請參考下方文件的範例:

Troubleshooting

  • 為何我一直收到 {"error":{"code":404,"message":"resource not found"}}

    1. 請確認有將 header 所需的資訊放入其中
    2. 請確認正在使用的 API key/secret 與 GraphQL endpoint 是匹配的
    3. 可以先試著寫單機版程式驗證簽名是否正確

About GraphQL

GraphQL 是一種用於查詢和操作 API 的查詢語言,你可以直接使用 fetch(or axios) 向 Qubic GraphQL Server 發送請求

我們建議使用 graphql-request 這套輕量的函式庫作為開發的工具,我們提供的範例也會使用它進行介紹

如果你有 GraphQL 的開發經驗,也可以使用 Apollo 進行溝通,我們建議將邏輯以 Apollo Link 的形式封裝

About