Closed godmmt closed 9 months ago
API 簡介|《精通 API 架構》導論
在軟體架構領域,有一些術語難以定義。就像 API,也就是 application programing interface(應用程式介面)。這個概念最早出現在非常久遠的 80 年前。已經存在很長時間的術語最終會被過度使用,並且在不同的問題空間有多種含義。我們認為 API 代表的是:
廣義上來講,API 可以分為兩大類,取決於 API 的呼叫是在行程內(in process)還是在行程外(out of process)。 這裡的行程是指作業系統(OS)的行程。
舉例來說,從一個類別到另一個類別的 Java 方法調用(method invocation)是行程內的 API 調用,因爲該呼叫是由進行呼叫的同一行程來處理的。 一個 .NET 應用程式使用 HTTP 程式庫呼叫外部的類 REST API 則是行程外的 API 調用,因爲該呼叫是由一個額外的外部行程所處理,而非由進行呼叫的行程處理。 行程外的 API 呼叫將涉及穿越網路的資料,那可能是區域網路、虛擬私有雲(virtual private cloud,VPC)網路、或網際網路(internet)。
相關名詞解釋|ChatGPT
"Greenfield technology" refers to the development or deployment of new systems, projects, or technology in an environment where there is little to no existing infrastructure or legacy systems. The term is often used in contrast to "brownfield," which refers to projects or systems built upon existing infrastructure or systems.
In the context of software development or technology projects, a greenfield project starts with a clean slate, allowing developers to create and implement solutions without the constraints or limitations imposed by pre-existing systems. This approach is common when there is a need for innovation, a departure from outdated technologies, or the creation of a completely new system.
Greenfield projects offer the advantage of flexibility and the ability to leverage the latest technologies and best practices. Developers have the freedom to design and implement solutions without being bound by the constraints of legacy systems, making it easier to adopt modern approaches and architectures.
On the other hand, greenfield projects may also pose challenges, such as the need to establish a new infrastructure from scratch and potential uncertainties in terms of requirements and project scope.
In summary, "greenfield technology" refers to the development of new technology projects in a fresh and unconstrained environment, unburdened by existing systems or infrastructure.
"Greenfield technology"(綠地技術)指的是在幾乎沒有現有基礎設施或遺留系統的環境中開發、部署新系統、專案或技術。這個術語通常與「brownfield」相對,後者指的是在現有基礎設施或系統之上構建的專案或系統。
在軟體開發或技術專案的背景下,綠地專案是從零開始的,允許開發人員在沒有受現有系統約束的情況下創建和實施解決方案。這種方法在需要創新、離開過時技術或創建全新系統的情況下很常見。
綠地專案具有靈活性的優勢,可以利用最新的技術和最佳實踐。開發人員可以在不受遺留系統約束的情況下設計和實施解決方案,更容易採用現代方法和架構。
另一方面,綠地專案可能也會面臨挑戰,比如需要從頭開始建立新的基礎設施,以及在需求和專案範圍方面可能存在的不確定性。
總而言之,「綠地技術」指的是在一個新鮮且不受現有系統或基礎設施約束的環境中開發新技術專案。
"Service-Oriented Architecture" (SOA) is an architectural style that structures software applications as a collection of loosely coupled services. These services can be thought of as independent, self-contained units of functionality that communicate with each other over a network. The goal of SOA is to enable the creation of flexible and scalable software systems by promoting reusability and interoperability among services.
Key features of Service-Oriented Architecture include:
SOA is commonly used in enterprise-level applications where there is a need for flexibility, scalability, and the ability to integrate diverse systems and technologies.
In summary, Service-Oriented Architecture is an approach to software design and development that structures applications as a collection of loosely coupled and reusable services, promoting flexibility, scalability, and interoperability.
"Service-Oriented Architecture"(服務導向架構,簡稱 SOA)是一種將軟體應用程式結構化為一組鬆散耦合服務的架構風格。這些服務可以被視為獨立的、自包含的功能單元,它們通過網路相互通信。SOA 的目標是通過促進服務之間的可重用性和互操作性,實現靈活且可擴展的軟體系統。
Service-Oriented Architecture 的主要特點包括:
SOA 常常應用於需要靈活性、可擴展性以及整合多樣系統和技術的企業級應用程式。
總而言之,服務導向架構是一種軟體設計和開發的方法,將應用程式結構化為一組鬆散耦合和可重用的服務,促進靈活性、可擴展性和互操作性。
"SaaS" stands for "Software as a Service." It is a cloud computing service model where software applications are provided over the internet on a subscription basis. Instead of users installing and maintaining the software on their local devices or servers, they access and use the software through a web browser.
Key characteristics of SaaS include:
SaaS has become a popular delivery model for various types of software, providing users with the flexibility to use applications without the burden of installation, maintenance, and infrastructure management.
"SaaS" 的全名是「軟體即服務」。它是一種雲端運算的服務模式,軟體應用程式以訂閱方式透過網際網路提供。
使用者無需在本地設備或伺服器上安裝和維護軟體,而是透過網頁瀏覽器存取和使用軟體。
SaaS 的主要特點包括:
SaaS 已成為各種軟體的流行交付模式,為使用者提供使用應用程式的靈活性,而無需擔心安裝、維護和基礎架構管理的負擔。
A "service mesh" is a dedicated infrastructure layer that facilitates communication, management, and monitoring between microservices in a distributed application. Microservices architecture involves breaking down an application into smaller, independently deployable services that work together to fulfill the overall application's functionality.
Key aspects of a service mesh include:
Popular service mesh implementations include Istio, Linkerd, and Envoy. These tools provide a way to manage the complexity of microservices interactions, offering a set of features that enhance reliability, security, and observability in a distributed application.
"Service mesh"(服務網格)是一個專用的基礎架構層,促進分布式應用中微服務之間的通信、管理和監控。微服務架構涉及將應用程序拆分為更小、獨立可部署的服務,這些服務共同工作以實現整體應用程序的功能。
服務網格的主要方面包括:
流行的服務網格實現包括 Istio、Linkerd 和 Envoy。這些工具提供了一種管理微服務交互複雜性的方式,提供一組功能,增強了分布式應用程序的可靠性、安全性和可觀察性。
"Incremental value" refers to the additional worth, benefit, or improvement gained by making a small, gradual, or incremental change or addition to a product, service, process, or project. It contrasts with radical or significant changes, emphasizing a step-by-step approach to enhancement.
Key points about incremental value include:
Overall, the concept of incremental value recognizes the value of making continuous, manageable improvements to achieve long-term goals, fostering adaptability and responsiveness in the face of evolving needs or circumstances.
"Incremental value"(漸進價值)指的是通過對產品、服務、流程或項目進行小規模、逐步或增量改變或增加而獲得的額外價值、利益或改進。這與激進或顯著的變化形成對比,強調了對增強的漸進式方法。
有關漸進價值的關鍵點包括:
總之,漸進價值的概念認識到,通過進行持續、可管理的改進來實現長期目標的價值,並在面對不斷變化的需求或情勢時培養適應性和靈活性。
REST API stands for "Representational State Transfer Application Programming Interface." It is an architectural style for designing networked applications. REST is not a protocol but a set of principles or constraints that, when applied to web services, create what is known as RESTful APIs.
Key principles of REST include:
RESTful APIs are widely used in web development because of their simplicity, scalability, and ease of integration. They are commonly used to enable communication between different software systems and allow for the creation of modular and scalable applications.
REST API 的全名是「表徵狀態傳輸應用程式介面」,是一種設計網路應用程式的架構風格。
REST 不是一個通訊協定,而是一組適用於 Web 服務的原則或約束,應用這些原則可以建立所謂的 RESTful API。
REST 的主要原則包括:
RESTful API 廣泛應用於 Web 開發,因其簡單性、可擴展性和易於整合。它們通常用於實現不同軟體系統之間的通信,並支持創建模塊化和可擴展的應用程式。
相關名詞解釋|《精通 API 架構》導論
在 API 層次,我們使用訊務模式來描述應用程式組之間的資料流。
就本書而言,我們指的是應用程式和 API 層級的訊務模式。
南北訊務(north-south traffic): 代表進入一個訊務(infress flow)。(需注意南北向訊務的安全性)
東西訊務(east-west traffic): 東西訊務可以被認為是一組應用程式內服務對服務(service-to-sevice)式的通訊。 大多數的東西向訊務,特別是當來源是在你更廣泛的基礎設施內之時,都可以在某種程度上被信任。(儘管可以信任訊務的來源,但仍須考慮保護東西向訊務的安全性)
以 API 為基礎的架構中存在兩個關鍵的基礎設施元件(infrastructure components),是控制訊務的關鍵。
控制和協調訊務通常被描述為訊務管理(traffic management)。
一般來說:
相關名詞解釋|ChatGPT
C4 diagrams refer to a set of visualizations used for modeling and documenting the architecture of a software system. The "C4" stands for "Context, Containers, Components, and Code," representing different levels of abstraction in depicting the system's architecture.
Here's a brief overview of each level in C4 diagrams:
C4 diagrams are part of the C4 model, which is a framework for visualizing the architecture of software systems. They promote clarity, simplicity, and consistency in communicating complex architectural concepts to different stakeholders, including developers, architects, and non-technical decision-makers. The C4 model is often used in combination with other documentation and methodologies to provide a comprehensive understanding of a software system's architecture.
C4 圖表是用於建模和記錄軟體系統架構的一套視覺化工具。
"C4" 代表 "Context(上下文)、Containers(容器)、Components(元件) 和 Code(程式碼)",分別代表了在呈現系統架構時的不同抽象層次。
以下是 C4 圖表中的每個層次的簡要概述:
C4 圖表是 C4 模型的一部分,該模型是一個用於可視化軟體系統架構的框架。它促進在不同利害關係人(包括開發人員、架構師和非技術決策者)之間傳達複雜架構概念的清晰、簡單和一致的方式。C4 模型通常與其他文件和方法結合使用,以全面理解軟體系統架構。
Architecture Decision Records (ADRs) are documents used to capture and communicate decisions made regarding a software system's architecture. ADRs serve as a valuable tool for documenting the context, options considered, and reasons behind architectural decisions, providing a historical record that aids in understanding the system's evolution.
Key components of an Architecture Decision Record typically include:
ADRs are particularly useful in the following scenarios:
By maintaining a collection of ADRs, development teams can create a comprehensive record of their architectural choices, fostering transparency and facilitating communication among team members.
建築決策記錄(ADR)是用於記錄和傳達有關軟體系統架構的決策的文件。
ADR 被視為一種有價值的工具,用於記錄決策的背景、考慮的選項以及背後的原因,提供了一個有助於理解系統演變的歷史記錄。
建築決策記錄通常包括以下主要組件:
建築決策記錄特別在以下情況下很有用:
P.S. 在「Architecture Decision Records」(ADRs)的背景下,「concerns」不是指擔憂或焦慮,而是指在做出架構決策時需要考慮的因素、要點或方面。當在一個ADR中記錄「Context」部分時,您會概述影響或促成該決策的關注點。這些關注點可能包括各種因素,如業務需求、性能考慮、可擴展性問題、安全需求、合規性問題、技術限制等。
相關名詞解釋|ChatGPT
"UML" stands for Unified Modeling Language. It is a standardized, general-purpose modeling language in the field of software engineering. UML provides a set of graphical notations for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system.
Key features of UML include:
Common types of UML diagrams include:
UML is widely used in the software development industry as a standard notation for visualizing and communicating system designs among developers, architects, and other stakeholders.
"UML" 代表統一建模語言。它是軟體工程領域中的標準通用建模語言。UML 提供了一套圖形符號,用於可視化、指定、構建和記錄軟體密集型系統的工件。
UML 的主要特點包括:
常見的 UML 圖表類型包括:
UML 在軟體開發行業中被廣泛使用,作為開發人員、架構師和其他利害關係人之間可視化和溝通系統設計的標準符號。
"Self-documenting" refers to the quality of a code or system that is designed in such a way that the code itself serves as documentation. In a self-documenting code, the structure, variable names, and comments within the code are clear and expressive enough to convey the purpose and functionality of the code without the need for external documentation. This approach aims to make the code easily understandable for both the original developer and others who may work on or maintain the code in the future. It contributes to improved readability and reduces the reliance on separate documentation files.
"Self-documenting" 的意思是代表程式碼或系統的品質,其設計方式使得程式碼本身充當文件。在自我記錄的程式碼中,程式碼的結構、變數名稱和註釋足夠清晰和表達性,可以在不需要外部文件的情況下傳達程式碼的目的和功能。 這種方法旨在使原始開發者和未來可能參與或維護程式碼的其他人更容易理解程式碼。它有助於提高代碼的可讀性,減少對單獨文件的依賴。
以下內容的資料來源:淺談 API 與 RESTful API
維基百科
應用程式介面(英語:Application Programming Interface),縮寫為API,是一種計算介面,它定義多個軟體中介之間的互動,以及可以進行的呼叫(call)或請求(request)的種類,如何進行呼叫或發出請求,應使用的資料格式,應遵循的慣例等。它還可以提供擴充機制,以便使用者可以通過各種方式對現有功能進行不同程度的擴充。一個API可以是完全客製化的,針對某個組件的,也可以是基於行業標準設計的以確保互操作性。通過資訊隱藏,API實現了模組化編程,從而允許使用者實現獨立地使用介面。
換個方式形容:
今天我(使用者)想要看哥吉拉的描述,但是這邊畫家很窮,每一次想看什麼,我都必須提供一張白紙,並附上一張信件的內容 (Request) 描述,舉例來講:畫家你好,我希望可以請你幫忙準備畫一張哥吉拉的畫像。 接下來我們就會請帥氣郵差先生/小姐(網路)幫我們將信件內容交給畫家(伺服器),接下來畫家就會依據我們信件內容開始準備畫筆並在我們一起寄給他的白紙繪畫上哥吉拉的畫像,最後繪畫完畢之後,畫家會再請郵差將畫好的繪畫一起寄回去給我來觀看。
其實概念就非常雷同,我們今天如果要寫信給朋友,就會請郵差依照我們提供的地址寄送給朋友,然後朋友就會依據信件內容回覆給我們。 我們套入程式的角度來看就像是:使用者(我)、郵差(API)、朋友(主機)
API 本身是一個你請求它做什麼事情,然後系統會依照你請求的回應給你什麼東西。
簡單來講 RESTful API 是一個 API 設計風格
早期我們在開發 API 的時候可能會是像以下這樣子來命名:
getUserAll
- 取得全部使用者getUser/1
- 取得特定使用者createUser
- 新增使用者editUser/1
- 編輯特定使用者deleteUser/1
- 刪除特定使用者看起來是相當直覺沒有錯,但如果是採用 RESTful API 的話,它則會長得像是以下:
/users
- 取得全部使用者/user/1
- 取得特定使用者/user
- 新增使用者/user/1
- 編輯特定使用者/user/1
- 刪除特定使用者我們可以看到 RESTful API 風格的設計方式具有以下優勢:
除此之外這邊也要注意一下 RESTful API 的一些設計重點:
/users
or /courses
,但我也有看過使用單數就是了。/user/1
or /course/1
,例如你要編輯單一使用者、單一課程這類就會建議使用單數。` or
_`
`,如
/my-course`。/products
但回傳的卻是使用者資料那也很奇怪吧?/abc
這類型無意義的命名。/shopping/products
。v1
、v2
作為差異區分,如:[Get] /v1/shopping/products
、[Put] /v1/shopping/product/1
。因此採用 RESTful API 風格設計是為了盡可能統一且可擴充,對於開發者來講也可以透過該 API 很直覺的理解到用途。
take 8 hrs remain 4 hrs
主任務:開 API 規格
子任務:
通常開 API 的流程是:等UI/UX畫面出來後,按照畫面開 API 規格 。
- UI/UX 畫面出來就能討論 API 了,不用等畫面刻完
好的,瞭解了,謝謝。
了解專案內容 卡在安裝開發環境 https://github.com/CAFECA-IO/BAIFA/issues/341 以及
主任務更新為:
remain 8 hrs
List all URLs in BAIFA
ignore root URL: https://baifa-boy6tsv96-cafeca.vercel.
check them bellow:
Here:
And go here:
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app (英文)
search 關鍵字提示 API ( request when input content change ) (input)
service root URL/api/v1/suggestions/:search-input?
search-input
Response :
{
"suggestions": ["app", "apple", "apple pie", "android", "avocado"]
}
search 回傳搜尋結果 API (request when button is clicked) (button)
轉跳到下方的 URL,並將 input value 用 params 傳遞 :
https://baifa-boy6tsv96-cafeca.vercel.app/en/app/searching-result?search=2300
進入此 URL 後自動打 API :
service root URL/api/v1/search/:search-input?
search-input
Response :
{
"success": true,
"value": [
{
"id": 0,
"name": "Bitcoin",
"blocks": 2,
"transactions": 6
},
{
"id": 1,
"name": "Binance",
"blocks": 1,
"transactions": 1
}
// ...
]
}
區塊鏈/加密貨幣/黑名單用戶 API
service root URL/api/v1/home-features
Response :
{
{
"id": 0,
"name": "Chains",
~~~~ "count": 5
},
{
"id": 1,
"name": "Crypto Currencies",
"count": 5
},
{
"id": 2,
"name": "Black List",
"count": 7
}
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains
Explore Blockchains API
service root URL/api/v1/chains-all
Response :
{
"success": true,
"value": [
{
"id": 0,
"name": "iSunCloud",
"blocks": 2,
"transactions": 6
},
{
"id": 1,
"name": "Ethereum",
"blocks": 2,
"transactions": 6
},
{
"id": 2,
"name": "Bitcoin",
"blocks": 2,
"transactions": 6
},
{
"id": 3,
"name": "Tether",
"blocks": 4,
"transactions": 7
},
{
"id": 4,
"name": "Binance",
"blocks": 1,
"transactions": 1
}
]
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/isun
Blocks API
service root URL/api/v1/isuncloud/blocks?start-date=:startTimestamp&end-date=:endTimestamp
start-date
、end-date
(startTimestamp
變數直接抓當下時間戳記,endTimestamp
可以設定成往前幾個天數)Response :
{
{
"id": 230021,
"date": 1679998900,
"category": "Blocks",
"stability_level":"High"
},
{
"id": 230676,
"date": 1679978920,
"category": "Blocks",
"stability_level": "Medium"
}
// ...
}
Blocks API query by Date (日曆功能)
service root URL/api/v1/isuncloud/blocks?start-date=:startTimestamp&end-date=:endTimestamp
start-date
、end-date
Response :
{
{
"id": 230021,
"date": 1679998900,
"category": "Blocks",
"stability_level":"High"
},
// ...
}
Transactions API
service root URL/api/v1/isuncloud/transations?start-date=:startTimestamp&end-date=:endTimestamp
start-date
、end-date
(startTimestamp
變數直接抓當下時間戳記,endTimestamp
可以設定成往前幾個天數)Response :
{
{
"id": 990071,
"date": 1692342345,
"category": "Transactions",
"stste": "success"
"asset_type":"Crypto Currency"
},
{
"id": 930291,
"date": 1689352675,
"category": "Evidence",
"state": "false",
"asset_type":"Crypto Currency"
},
{
"id": 930032,
"date": 1688342795,
"category": "Transactions",
"state": "pending"
"asset_type":"NFT"
}
// ...
}
Transactions API query by Date (日曆功能)
service root URL/api/v1/isuncloud/transations?start-date=:startTimestamp&end-date=:endTimestamp
start-date
、end-date
Response :
{
{
"id": 990071,
"date": 1692342345,
"category": "Transactions",
"stste": "success"
"asset_type":"Crypto Currency"
},
// ...
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/isun/block/230676
前一個URL點選後,將 230676 這個 block id 用params傳至這個URL
Block API
service root URL/api/v1/isuncloud/block/:block-id
Response :
{
"id": 230021,
"date": 1679998900,
"stability_level":"High",
"management-team":[],
"content":[{},{},{}],
"miner_and_reward":{},
"size": 3523
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app (英文)、 https://baifa-boy6tsv96-cafeca.vercel.app/app (正體中文)、 https://baifa-boy6tsv96-cafeca.vercel.app/cn/app (簡體中文)
畫面:
001 Search suggestions API (關鍵字提示)
service root URL/api/v1/suggestions/:search-input?
search-input
{
"suggestions": ["app", "apple", "apple pie", "android", "avocado"]
}
002 Search Result API
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/searching-result
service root URL/api/v1/search-result?search=2300
{
{
"blockId": 230021,
"createdDate": 1679998900,
"category": "Block",
"stabilityLevel":"High"
},
{
"blockId": 230676,
"createdDate": 1679978920,
"category": "Block",
"stabilityLevel": "Medium"
}
// ...
}
003 home features API (區塊鏈/加密貨幣/黑名單用戶)
service root URL/api/v1/home-features
{
{
"id": 0,
"name": "Chains",
"count": 5,
},
{
"id": 1,
"name": "Crypto Currencies",
"count": 5,
},
{
"id": 2,
"name": "Black List",
"count": 7,
}
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains
畫面:
004 Chains API
service root URL/api/v1/chains-all
{
"success": true,
"value": [
{
"chainId": 0,
"chainName": "iSunCloud",
"blocks": 2,
"transactions": 6,
"category": "Chain"
},
{
"chainId": 1,
"chainName": "Ethereum",
"blocks": 2,
"transactions": 6,
"category": "Chain"
},
{
"chainId": 2,
"chainName": "Bitcoin",
"blocks": 2,
"transactions": 6,
"category": "Chain"
},
{
"chainId": 3,
"chainName": "Tether",
"blocks": 4,
"transactions": 7,
"category": "Chain"
},
{
"chainId": 4,
"chainName": "Binance",
"blocks": 1,
"transactions": 1,
"category": "Chain"
}
]
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/isun
畫面 :
005 Blocks API :
service root URL/api/v1/isuncloud/blocks?start_date=:startTimestamp&end_date=:endTimestamp
start_date
、end_date
(startTimestamp
變數直接抓當下時間戳記,endTimestamp
可以設定成往前幾個天數){
{
"blockId": 230021,
"createdDate": 1679998900,
"category": "Block",
"stabilityLevel":"High"
},
{
"blockId": 230676,
"createdDate": 1679978920,
"category": "Block",
"stabilityLevel": "Medium"
}
// ...
}
006 Blocks API query by Date (日曆功能)
service root URL/api/v1/isuncloud/blocks?start_date=:startTimestamp&end_date=:endTimestamp
start_date
、end_date
{
{
"blockId": 230021,
"createdDate": 1679998900,
"category": "Block",
"stabilityLevel":"High"
},
// ...
}
007 Transactions API
service root URL/api/v1/isuncloud/transactions?start_date=:startTimestamp&end_date=:endTimestamp
start_date
、end_date
(startTimestamp
變數直接抓當下時間戳記,endTimestamp
可以設定成往前幾個天數){
{
"category": "Transaction",
"transactionId": 930071,
"transactionTime": 1692342345,
"belongBlock": 230021,
"transactionStatus": "success",
"assetType":"Crypto Currency",
},
{
"category": "Transaction",
"transactionId": 930291,
"transactionTime": 1689352675,
"belongBlock": 230676,
"transactionStatus": "false",
"assetType":"Evidence",
},
{
"category": "Transaction",
"transactionId": 930032,
"transactionTime": 1688342795,
"belongBlock": 230021,
"transactionStatus": "pending",
"assetType":"NFT",
}
// ...
}
008 Transactions API query by Date (日曆功能)
service root URL/api/v1/isuncloud/transactions?start_date=:startTimestamp&end_date=:endTimestamp
start_date
、end_date
{
{
"category": "Transaction",
"transactionId": 930071,
"transactionTime": 1692342345,
"belongBlock": 230021,
"transactionStatus": "success",
"assetType":"Crypto Currency",
},
// ...
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/isun/block/230676
畫面:
備註:前一個 URL 點選後,將 230676 這個 block id 用 params 傳至這個 URL
009 Block API :
service root URL/api/v1/isuncloud/block/:block_id
{
"blockId": 230676,
"createdDate": 1679998900,
"stabilityLevel": "High",
"managementTeam": ["Linda", "Liam"],
"transactionsContent": [
{
"category": "Transaction",
"hash": "0x773A74Cd884139069fEc25f56f9537631A62773",
"transactionId": 916841,
"assetType": "Evidence",
"transactionStatus": "Failed",
"transactionTime": 1698742345,
"belongBlock": 217328,
"addressFrom": 115588,
"addressTo": 311382,
"evidence": 515482,
"value": 0,
"transactionFee": 0.01,
"transactionFeeUnit": "BLT",
"flagging": null,
"privateNote": "This is my private note."
}
// ...
],
"miner": 0,
"reward": 0.01,
"size": 3523
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/transaction-list?blockId=230676
畫面:
備註:前一個 URL 點選後,將 230676 這個 block id 用 params 傳至此 URL
010 Transactions of a block API :
service root URL/api/v1/isuncloud/transactions?start_date=:startTimestamp&end_date=:endTimestamp&block_id=:blockId
start_date
、end_date
、block_id
(startTimestamp
變數直接抓當下時間戳記,endTimestamp
可以設定成往前幾個天數){
{
"category": "Transaction",
"transactionId": 916841,
"assetType": "Evidence",
"transactionStatus": "Failed",
"transactionTime": 1698742345,
},
{
"category": "Transaction",
"transactionId": 914025,
"assetType": "Crypto Currency",
"transactionStatus": "Success",
"transactionTime": 1698342345,
},
{
"category": "Transaction",
"transactionId": 930071,
"assetType": "Crypto Currency",
"transactionStatus": "Success",
"transactionTime": 1692342345,
},
// ...
}
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/btc/transaction/916841
011 Transaction API
service root URL/api/v1/isuncloud/transaction/:transactionId?
{
{
"category": "Transaction",
"transactionId": 916841,
"transactionTime": 1698742345,
"assetType": "Evidence",
"transactionStatus": "Failed",
"belongBlock": 217328,
"addressFrom": 115588,
"addressTo": 311382,
"evidence": 515482,
"value": 100,
"transactionFee": 0.01,
"flagging": "None",
"privateNote": "This is a private note."
},
}
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/currencies
012 Currencies API
service root URL/api/v1/currencies
{
{
"category": "Currency",
"currencyName": "Bitcoin",
"redFlag": [
{
"category": "Address",
"addressID": 112840,
"flagType": "Multiple Transfer",
"createTime": 1686230832,
},
// ...
]
},
}
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/currencies/btc
013 Currency API
service root URL/api/v1/currency/:currencyName
{
"category": "Currency",
"currencyName": "Bitcoin",
"price": 27755.4,
"volumeIn24Hours": 14867304472,
"totalAmount": 19388600,
"totalAmountUnit":"BTC",
"holders": [
{
"category": "Address",
"addressId": 110029,
"address": "0x156f9f74C2775D3190693fEc256dd8843A79",
"SignUpTime": 1667129031,
"LatestActiveTime": 200,
"RelatedAddresses": [110132, 114007],
"InteractedWith": [[110132, 114007],[]],
},
// ...
],
"totalTransfers": 48010097,
"redFlag": [
{
"category": "Address",
"addressID": 112840,
"flagType": "Multiple Transfer",
"createTime": 1686230832,
},
// ...
],
},
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/btc/address/110029
014 Address API
service root URL/api/v1/address/:addressId
{
"category": "Address",
"addressId": 110029,
"address": "0x156f9f74C2775D3190693fEc256dd8843A79",
"signUpTime": 1667129031,
"LatestActiveTime": 200,
"RelatedAddresses": [110132, 114007],
"InteractedWith": [
[110132, 114007], // addresses
[] // contracts
],
"redFlag": [
{
"category": "Address",
"addressID": 110029,
"flagType": "Multiple Withdraw",
"createTime": 1686230832,
},
// ...
],
"balance": 0,
"totalSent": 0,
"totalReceived": 0,
"privateNote": "",
"reviews": {},
"transactionHistory": {},
"blockProducedHistory": {},
},
14 APIs : for now total used 16 hours (total: 10 URLs) 5 URLs remaining : need more 4 hours
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app
001 Search suggestions API (關鍵字提示)
service root URL/api/v1/suggestions/:searchInput
{
"suggestions": ["app", "apple", "apple pie", "android", "avocado"]
}
002 Search Result API
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/searching-result
service root URL/api/v1/search-result?search_input=:searchInput
[
{
"blockId": 230021,
"createdDate": 1679998900,
"category": "Block",
"stabilityLevel": "High"
},
{
"blockId": 230676,
"createdDate": 1679978920,
"category": "Block",
"stabilityLevel": "Medium"
}
// ...
]
003 home features API (區塊鏈/加密貨幣/黑名單用戶)
service root URL/api/v1/home-features
[
{
"id": 0,
"name": "Chains",
"count": 5
},
{
"id": 1,
"name": "Crypto Currencies",
"count": 5
},
{
"id": 2,
"name": "Black List",
"count": 7
}
]
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains
004 Chains API
service root URL/api/v1/chains-all
{
"success": true,
"value": [
{
"chainId": "isun",
"chainName": "iSunCloud",
"blocks": 2,
"transactions": 6,
"category": "Chain"
},
{
"chainId": "eth",
"chainName": "Ethereum",
"blocks": 2,
"transactions": 6,
"category": "Chain"
},
{
"chainId": "btc",
"chainName": "Bitcoin",
"blocks": 2,
"transactions": 6,
"category": "Chain"
},
{
"chainId": "usdt",
"chainName": "Tether",
"blocks": 4,
"transactions": 7,
"category": "Chain"
},
{
"chainId": "bnb",
"chainName": "Binance",
"blocks": 1,
"transactions": 1,
"category": "Chain"
}
]
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/isun
005 Blocks API :
service root URL/api/v1/:chainId/blocks?start_date=:startTimestamp&end_date=:endTimestamp
start_date
、end_date
(startTimestamp
變數直接抓當下時間戳記,endTimestamp
可以設定成往前幾個天數)[
{
"blockId": 230021,
"createdDate": 1679998900,
"category": "Block",
"stabilityLevel": "High"
},
{
"blockId": 230676,
"createdDate": 1679978920,
"category": "Block",
"stabilityLevel": "Medium"
}
// ...
]
006 Blocks API query by Date (日曆功能)
service root URL/api/v1/:chainId/blocks?start_date=:startTimestamp&end_date=:endTimestamp
start_date
、end_date
[
{
"blockId": 230021,
"createdDate": 1679998900,
"category": "Block",
"stabilityLevel": "High"
}
// ...
]
007 Transactions API
service root URL/api/v1/:chainId/transactions?start_date=:startTimestamp&end_date=:endTimestamp
start_date
、end_date
(startTimestamp
變數直接抓當下時間戳記,endTimestamp
可以設定成往前幾個天數)[
{
"category": "Transaction",
"transactionId": 930071,
"transactionTime": 1692342345,
"belongBlock": 230021,
"transactionStatus": "success",
"assetType": "Crypto Currency"
},
{
"category": "Transaction",
"transactionId": 930291,
"transactionTime": 1689352675,
"belongBlock": 230676,
"transactionStatus": "false",
"assetType": "Evidence"
},
{
"category": "Transaction",
"transactionId": 930032,
"transactionTime": 1688342795,
"belongBlock": 230021,
"transactionStatus": "pending",
"assetType": "NFT"
}
// ...
]
008 Transactions API query by Date (日曆功能)
service root URL/api/v1/:chainId/transactions?start_date=:startTimestamp&end_date=:endTimestamp
start_date
、end_date
[
{
"category": "Transaction",
"transactionId": 930071,
"transactionTime": 1692342345,
"belongBlock": 230021,
"transactionStatus": "success",
"assetType": "Crypto Currency"
}
// ...
]
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/isun/block/230676
備註:前一個 URL 點選後,將 230676 這個 block id 用 params 傳至這個 URL
009 Block API :
service root URL/api/v1/:chainId/block/:block_id
{
"blockId": 230676,
"createdDate": 1679998900,
"stabilityLevel": "High",
"managementTeam": ["Linda", "Liam"],
"transactionsContent": [
{
"category": "Transaction",
"hash": "0x773A74Cd884139069fEc25f56f9537631A62773",
"transactionId": 916841,
"assetType": "Evidence",
"transactionStatus": "Failed",
"transactionTime": 1698742345,
"belongBlock": 217328,
"addressFrom": 115588,
"addressTo": 311382,
"evidence": 515482,
"value": 0,
"transactionFee": 0.01,
"transactionFeeUnit": "BLT",
"flagging": null,
"privateNote": ""
}
// ...
],
"miner": 0,
"reward": 0.01,
"size": 3523
}
URL : https://baifa-boy6tsv96-cafeca.vercel.app/en/app/transaction-list?blockId=230676
備註:前一個 URL 點選後,將 230676 這個 block id 用 params 傳至此 URL
010 Transactions of a block API :
service root URL/api/v1/:chainId/transactions?start_date=:startTimestamp&end_date=:endTimestamp&block_id=:blockId
start_date
、end_date
、block_id
(startTimestamp
變數直接抓當下時間戳記,endTimestamp
可以設定成往前幾個天數)[
{
"category": "Transaction",
"transactionId": 916841,
"assetType": "Evidence",
"transactionStatus": "Failed",
"transactionTime": 1698742345
},
{
"category": "Transaction",
"transactionId": 914025,
"assetType": "Crypto Currency",
"transactionStatus": "Success",
"transactionTime": 1698342345
},
{
"category": "Transaction",
"transactionId": 930071,
"assetType": "Crypto Currency",
"transactionStatus": "Success",
"transactionTime": 1692342345
}
// ...
]
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/btc/transaction/916841
011 Transaction API
service root URL/api/v1/:chainId/transaction/:transactionId
{
"category": "Transaction",
"transactionId": 916841,
"transactionTime": 1698742345,
"assetType": "Evidence",
"transactionStatus": "Failed",
"belongBlock": 217328,
"addressFrom": 115588,
"addressTo": 311382,
"evidence": 515482,
"value": 100,
"transactionFee": 0.01,
"flagging": "None",
"privateNote": ""
}
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/currencies
012 Currencies API
service root URL/api/v1/currencies
[
{
"category": "Currency",
"currencyName": "Bitcoin",
"redFlag": [
{
"category": "Address",
"addressID": 112840,
"flagType": "Multiple Transfer",
"signUpTime": 1686230832
}
// ...
]
},
{
"category": "Currency",
"currencyName": "Ethereum",
"redFlag": [
{
"category": "Address",
"addressID": 112840,
"flagType": "Multiple Transfer",
"signUpTime": 1686230832
}
// ...
]
}
]
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/currencies/btc
013 Currency API
service root URL/api/v1/currency/:currencyId
{
"category": "Currency",
"currencyId": "btc",
"currencyName": "Bitcoin",
"price": 27755.4,
"volumeIn24Hours": 14867304472,
"totalAmount": 19388600,
"totalAmountUnit":"BTC",
"holders": [
{
"category": "Address",
"addressId": 110029,
"walletType": "Binance-coldwallet",
"amount": 248567,
},
{
"category": "Address",
"addressId": 110123,
"walletType": "Binance-coldwallet",
"amount": 178010,
},
{
"category": "Address",
"addressId": 112840,
"walletType": "Unknown User",
"amount": 117351,
},
{
"category": "Address",
"addressId": 114007,
"walletType": "Unknown User",
"amount": 93109,
},
{
"category": "Address",
"addressId": 115588,
"walletType": "Unknown User",
"amount": 62352,
},
],
"totalTransfers": 48010097,
"redFlag": [
{
"category": "Address",
"addressID": 112840,
"flagType": "Multiple Transfer",
"signUpTime": 1686230832,
},
// ...
],
},
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/btc/address/110029
014 Address API
service root URL/api/v1/address/:addressId
{
"category": "Address",
"addressId": 110029,
"address": "0x156f9f74C2775D3190693fEc256dd8843A79",
"signUpTime": 1667129031,
"latestActiveTime": 200,
"relatedAddresses": [110132, 114007],
"interactedWith": [
[110132, 114007], // addresses
[] // contracts
],
"redFlag": [
{
"category": "Address",
"addressID": 110029,
"flagType": "Multiple Withdraw",
"createTime": 1686230832,
},
// ...
],
"balance": 0,
"totalSent": 0,
"totalReceived": 0,
"privateNote": "",
"reviews": [],
"transactionHistory": [],
"blockProducedHistory": [],
},
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/btc/address/110029/interaction?type=address
015 Interaction List of Address API
service root URL/api/v1/address/:chainId/:addressId/interaction?type=address
[
{
"category": "Address",
"addressId": 110132,
"transactionHistory": [916841, 914025, 930071, 915024, 918402, 912299, 913211, 930291, 920219, 931314]
},
{
"category": "Address",
"addressId": 114007,
"transactionHistory": [916841, 914025, 930071, 915024, 918402, 912299, 913211, 930291, 920219, 931314]
}
]
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/transaction-list?addressId=114007&addressId=110029
016 Transaction History of Addresses
service root URL/api/v1/transaction-list?address_id=:addressId&address-id=:addressId
[
{
"category": "Transaction",
"transactionId": 916841,
"assetType": "Evidence",
"transactionTime": 1698742345,
"transactionStatus": "Failed"
},
{
"category": "Transaction",
"transactionId": 914025,
"assetType": "Crypto Currency",
"transactionTime": 1698342345,
"transactionStatus": "Success"
}
// ...
]
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/chains/btc/contract/311382
017 Contract API
service root URL/api/v1/:chainId/contract/:contractId
{
"contractId": "311382",
"contractAddress": "0xb61e1747cb5b2b9ff4a5dd18e625c1b55475d4d5",
"user": "Unknown User",
"creator": {
"category": "Address",
"addressId": 114007
},
"createdTime": 1698321919,
"sourceCode": "",
"privateNote": "",
"transactionHistory": [
{
"addressFrom": 114007,
"transactionTime": 1698742345,
"transactionStatus": "Success"
},
{
"addressFrom": 114007,
"transactionTime": 1698742345,
"transactionStatus": "Success"
}
]
}
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/currencies/btc/red-flag
018 Red Flag of A Currency API
service root URL/api/v1/currency/:currencyId/red-flag
[
{
"category": "Address",
"addressID": 112840,
"flagType": "Multiple Transfer",
"signUpTime": 1686230832
},
{
"category": "Address",
"addressID": 112840,
"flagType": "Large Withdraw",
"signUpTime": 1686330832
},
{
"category": "Address",
"addressID": 112840,
"flagType": "Large Deposit",
"signUpTime": 1686530832
},
{
"category": "Address",
"addressID": 112840,
"flagType": "To High Risk Location",
"signUpTime": 1686430832
}
// ...
]
URL: https://baifa-boy6tsv96-cafeca.vercel.app/en/app/blacklist
019 Black List APT
service root URL/api/v1/blacklist
[
{
"addressId": 140050,
"signUpTime": 1681366321,
"belongChain": "Tether"
},
{
"addressId": 122810,
"signUpTime": 1687222335,
"belongChain": "Ethereum"
},
{
"addressId": 121700,
"signUpTime": 1688223345,
"belongChain": "Ethereum"
}
// ...
]
done.
19 APIs : total used 20 hours (total: 15 URLs)
this issue total used : 37 hours
API 規格
認識理解 API 查找相關資料文件
參考資料: 《精通 API 架構》
預計參考網路文章: