生活随笔
收集整理的這篇文章主要介紹了
AgileConfig - RESTful API 介绍
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
AgileConfig
AgileConfig是一個(gè)基于.net core開(kāi)發(fā)的輕量級(jí)配置中心。
AgileConfig秉承輕量化的特點(diǎn),部署簡(jiǎn)單、配置簡(jiǎn)單、使用簡(jiǎn)單、學(xué)習(xí)簡(jiǎn)單,它只提取了必要的一些功能,并沒(méi)有像Apollo那樣復(fù)雜且龐大。但是它的功能也已經(jīng)足夠你替換webconfig,appsettings.json這些文件了。如果你不想用微服務(wù)全家桶,不想為了部署一個(gè)配置中心而需要看N篇教程跟幾臺(tái)服務(wù)器那么你可以試試AgileConfig :)
RESTful Api
為了更加方便的跟業(yè)務(wù)系統(tǒng)集成最新版的AgileConfig已支持json格式的 restful api來(lái)維護(hù)配置 。
本API入?yún)⒏鰠閖son格式,所以請(qǐng)求的時(shí)候需設(shè)置Content-Type頭部為application/json 。
使用basic簡(jiǎn)單認(rèn)證,設(shè)置Authorization頭部為Basic base64(userName:password) 。
當(dāng)操作節(jié)點(diǎn)、應(yīng)用api的時(shí)候basic認(rèn)證的userName固定設(shè)置為admin,password為當(dāng)前密碼 。
當(dāng)操作配置api的時(shí)候basic認(rèn)證的userName為應(yīng)用的appid,password為應(yīng)用的秘鑰 。
節(jié)點(diǎn)
因?yàn)楸鞠到y(tǒng)登錄的時(shí)候沒(méi)有用戶(hù)名所以basic認(rèn)證的時(shí)候用戶(hù)名固定使用admin密碼為當(dāng)前設(shè)置的密碼
model
{"address": "http://localhost:5000","remark": "this","status": 0, // 1=online 0=offile"lastEchoTime": null}
獲取所有節(jié)點(diǎn)
參數(shù)名值
| url | /api/node |
| method | GET |
| status code | 200 |
| response content | [model] |
添加節(jié)點(diǎn)
參數(shù)名值
| url | /api/node |
| method | POST |
| status code | 201 |
| request body | model |
| response content | 空 |
刪除節(jié)點(diǎn)
參數(shù)名值
| url | /api/node?address={address} |
| method | DELETE |
| status code | 204 |
| response content | 空 |
應(yīng)用
因?yàn)楸鞠到y(tǒng)登錄的時(shí)候沒(méi)有用戶(hù)名所以basic認(rèn)證的時(shí)候用戶(hù)名固定使用admin密碼為當(dāng)前設(shè)置的密碼
model
{"id": "xxx","name": "測(cè)試程序3","secret": "","enabled": true, //是否啟用"inheritanced": true, //是否可以繼承"inheritancedApps": null //繼承的app列表}
獲取所有應(yīng)用
參數(shù)名值
| url | /api/app |
| method | GET |
| status code | 200 |
| response content | [model] |
獲取單一應(yīng)用
參數(shù)名值
| url | /api/app/{appid} |
| method | GET |
| status code | 200 |
| response content | model |
添加應(yīng)用
參數(shù)名值
| url | /api/app |
| method | POST |
| status code | 201 |
| request body | model |
| response content | 空 |
修改應(yīng)用
參數(shù)名值
| url | /api/app |
| method | PUT |
| status code | 200 |
| request body | model |
| response content | 空 |
配置
配置的basic認(rèn)證用戶(hù)名使用appId密碼使用secret
model
{"id": "0986e7ed33c447618f28e92360394cea","appId": "xxx","group": "", //組"key": "key1", "value": "3333","description": null, //描述"onlineStatus": 0, //是否在線 0=等待上線 1=在線"status": 1 // 0=刪除 1=正常}
獲取所有app的配置
參數(shù)名值
| url | /api/config |
| method | GET |
| status code | 200 |
| response content | [model] |
獲取單一配置
參數(shù)名值
| url | /api/config/{id} |
| method | GET |
| status code | 200 |
| response content | model |
新建配置
參數(shù)名值
| url | /api/config |
| method | POST |
| status code | 201 |
| request body | model |
| response content | 空 |
修改配置
參數(shù)名值
| url | /api/config |
| method | PUT |
| status code | 200 |
| request body | model |
| response content | 空 |
刪除配置
參數(shù)名值
| url | /api/config/{id} |
| method | DELETE |
| status code | 204 |
| response content | 空 |
上線配置
參數(shù)名值
| url | /api/config/publish/{id} |
| method | POST |
| status code | 200 |
| response content | 空 |
下線配置
參數(shù)名值
| url | /api/config/offline/{id} |
| method | POST |
| status code | 200 |
| response content | 空 |
相關(guān)內(nèi)容:
AgileConfig-如何使用AgileConfig.Client讀取配置
AgileConfig-輕量級(jí)配置中心 1.1.0 發(fā)布,支持應(yīng)用間配置繼承
造輪子-AgileConfig基于.NetCore的一個(gè)輕量級(jí)配置中心
gihub地址:
https://github.com/kklldog/AgileConfig
https://github.com/kklldog/AgileConfig_Client
總結(jié)
以上是生活随笔為你收集整理的AgileConfig - RESTful API 介绍的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。