天道酬勤,学无止境

apiary

Repeating a MSON data structure with different values

I have many places in my API where I will need to describe a list of objects. Each object has the same keys / structure but different values. How can I tweak the values of each instance of some data structure while retaining all the original type, description, etc of the original structure? for example if I had the following data structure Restaurant # Data Structures ## Restaurant (object) + restaurant_name: McDonald's (string, required) - The name of this restaurant + years_of_operation: 54 (number, required) - The number of years since established Then, let's say I want to instantiate

2022-03-17 06:43:20    分类:问答    apiblueprint   apiary.io   apiary   MSON

Apiary.io - multiple responses (200) with different parameters

I am trying to get different responses passing different parameters but something is not working. This is my API: ## Question [/questions/{question_id}] A Question object has the following attributes: + Parameters + question_id: `1` (number, required) - ID of the Question in form of an integer ### View a Questions Detail [GET] + Request + Header X-Custom-Header : 1 + Response 200 (application/json) { "id": "1", "name": "Marco" } + Request + Header X-Custom-Header : 2 + Response 200 (application/json) { "id: "2", "name": "Lucas" } But when calling /questions/1 or /questions/2 the response is

2022-03-09 01:28:02    分类:问答    rest   restful-architecture   apiblueprint   apiary.io   apiary

Apiary:将 API 导出为 JSON,生成客户端代码(Apiary: Export API as JSON, to generate client code)

问题 我们都知道养蜂场岩石(或不岩石。我认为确实如此),我想知道如何进一步允许用户导出 API 的 JSON 描述? (因此开发人员可以编写客户端代码生成脚本) 这应该有帮助:http://ttezel.github.io/blog/2013/02/23/stop-writing-rest-api-clients/ 回答1 您可以探索两个方向: 您可以使用 Alpaca 生成客户端 SDK。 Alpaca 接受 API Blueprint 作为其输入格式之一为了获得更大的灵活性,您可以使用 Snowcrash 将 API 蓝图解析为 JSON - 并推出您自己的代码生成器。 在 http://apiblueprint.org/ 上有更多关于 API Blueprint 的工具可用

2022-01-12 13:14:23    分类:技术分享    apiblueprint   apiary.io   apiary

Apiary: Export API as JSON, to generate client code

We all know that apiary rocks (or not.. I think it does), and I was wondering what would it take to take it a step further allow users to export a JSON description of the API? (So developers can script client code generation) This should help: http://ttezel.github.io/blog/2013/02/23/stop-writing-rest-api-clients/

2022-01-08 09:02:58    分类:问答    apiblueprint   apiary.io   apiary

Apiary:是否可以记录 JSON 响应字段是什么?(Apiary: Is it possible to document what JSON response fields are?)

问题 我想记录实际的 JSON 字段本身代表什么。 我已经记录了 GET 语句和参数,但这并没有提供给用户的完整文档。 因此,在下面的示例中,我将如何添加有关“OtherFields”的评论。 这是支持的吗? 或者我需要在其他地方制作一份配套文件。 ## View Applications [/cat{?sort}{&order}{&page}] ### List all Applications ### Get List of Applications [GET] + Parameters + sort (optional, string) ... `sort` parameter is used to specify which criteria to use for sorting. One of the following strings may be used: `"NAME", "RATING", "QUALITY" , "RISKLEVEL", ` + order (optional, string) ... `order` parameter is used to specify which order to use if sorting is used. One of the following strings may be used: `"ASC", "DESC

2021-12-21 00:07:12    分类:技术分享    json   apiblueprint   apiary

Apiary: Is it possible to document what JSON response fields are?

I would like to document what the actual JSON fields themselves represent. I have documented the GET statement, and parameters but this does not make a complete documentation to give to users. So, in the example below how would I add a comment about "OtherFields". Is this supported? Or do I need to make a companion document somewhere else. ## View Applications [/cat{?sort}{&order}{&page}] ### List all Applications ### Get List of Applications [GET] + Parameters + sort (optional, string) ... `sort` parameter is used to specify which criteria to use for sorting. One of the following strings may

2021-12-11 00:12:32    分类:问答    json   apiblueprint   apiary

尝试使用 API Blueprint 中的数据结构来描述请求和响应(Trying to describe the request and response using Data Structures in API Blueprint)

问题 我正在尝试使用规范的新 Attributes 和 DataStructures 部分来记录带有 API Blueprint 的端点。 我的请求负载如下所示: { "url": "http://requestb.in/11v7i7e1", "active": true, "types": [ { "name": "sales", "version": "2.0" }, { "name": "products", "version": "2.0" } ] } 我的响应负载看起来像这样: { "data": { "id": "dc85058a-a683-11e4-ef46-e9431a15be8c", "url": "http://requestb.in/11v7i7e1", "active": true, "types": [ { "name": "products", "version": "2.0" }, { "name": "sales", "version": "2.0" } ] } } 我尝试了以下 API 蓝图降价: FORMAT: 1A # Vend REST API 2.0 # Group Webhooks ## api/2.0/webhooks [/webhooks] ### List all Webhooks [GET] Returns a list of

2021-11-29 17:34:54    分类:技术分享    api   apiblueprint   apiary.io   apiary   MSON

Trying to describe the request and response using Data Structures in API Blueprint

I'm trying to document an endpoint with API Blueprint, using the new Attributes and DataStructures sections of the spec. My request payload looks like this: { "url": "http://requestb.in/11v7i7e1", "active": true, "types": [ { "name": "sales", "version": "2.0" }, { "name": "products", "version": "2.0" } ] } My response payload looks something like that: { "data": { "id": "dc85058a-a683-11e4-ef46-e9431a15be8c", "url": "http://requestb.in/11v7i7e1", "active": true, "types": [ { "name": "products", "version": "2.0" }, { "name": "sales", "version": "2.0" } ] } } I tried the following API Blueprint

2021-11-21 17:46:02    分类:问答    api   apiblueprint   apiary.io   apiary   MSON

在 API 蓝图中表示文件上传(Represent File Uploads in API Blueprints)

问题 我们有一个 API 端点,可以在其中上传图像文件以及文件名(字符串)和描述(字符串)。 Apiary / API Blueprints 不允许我有类似的东西: + Request (multipart/form-data) + Headers Authorization: [key] + Attributes + name (string, required) - A human-readable name of the Catalog Item + description (string, optional) - A human readable description of the Catalog Item + image (file, optional) - An image file corresponding to the Catalog Item 我得到: base type 'file' is not defined in the document 有没有办法在 API Blueprints 中表示多部分/表单数据,例如上述内容?

2021-10-18 19:10:16    分类:技术分享    apiblueprint   apiary.io   apiary