天道酬勤,学无止境

apiary.io

尝试使用 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

MSON在蓝图中描述对象属性(MSON to describe object attributes in blueprint)

问题 我有一个类似于这里描述的问题。 我有一个看起来像这样的 JSON: { "photos": [ { "key": "y37dmj10jkwof/moOIUB8912JKVgh", "caption": "A world of gamers.", "tags": [ "game", "japan" ], "attributes": { "copyright": true, "use": [ "public", "private" ] } } ] } 我正在尝试使用 MSON 描述属性,以呈现蓝图。 但是,我并不成功。 这是我的尝试: + Attributes (required, object) + photos (required, array) + (object) + key (required, string) - Photo key + caption (required, string) - Photo caption + tags (required, array) + game (string) + japan (string) + attributes (required, object) + (object) + copyright: true (required, boolean) + uses (required, array) + public

2021-09-23 18:36:38    分类:技术分享    apiblueprint   apiary.io   apiary   MSON

如何将 API 版本添加到 Apiary Mock Server(How to add API version to Apiary Mock Server)

问题 有什么方法可以将 API 版本添加到 Apiary Mock Server? 例:http://private-XXXXX-apiname.apiary-mock.com/ v1 /嘲笑/ 1?学校ID = 1 回答1 是的,在声明HOST ,您可以为其附加后缀,然后将其作为前缀传播到所有资源: FORMAT: 1A HOST: http://api.example.tld/v1/

2021-09-20 23:53:33    分类:技术分享    apiary.io   apiary

使用 Apiary 创建模拟服务 API(Create Mock Service API using Apiary)

问题 我正在尝试创建用于测试目的的模拟 api 服务。 我们已经在另一个团队中使用 Apiary,所以我从那里开始。 到目前为止,我注意到如果我想要两个单独的调用需要模拟两个请求。 例如,要获取 ID 为 1 和 2 的注释,需要明确写出如下响应: /notes/1 /notes/2 有没有办法避免这种情况? 不可否认,我仍在努力创建蓝图。 回答1 看看 private-e9e59-pingdomcheck.apiary-mock.com/v1/gists/1。 这里的数字1是{id} 。 您当然只能得到一般定义的响应(就像我使用 id 42 一样)。 现在在 MSON 中有更多的事情要做。 一旦发布,请求中不同参数的不同回复将是可能的。

2021-09-18 17:42:55    分类:技术分享    apiblueprint   apiary.io   apiary

How to add API version to Apiary Mock Server

Is there any way to add API version to Apiary Mock Server? Ex.: http://private-XXXXX-apiname.apiary-mock.com/v1/mocks/1?school_id=1

2021-09-05 11:05:49    分类:问答    apiary.io   apiary

为我们在 Apiary.io 中的每个响应指定描述(Specify description for every response we have in Apiary.io)

问题 是否可以为某个请求的每个响应指定描述? 假设,我们有一个请求 ### Retrieve resource [GET] + Headers If-None-Match: "Version1" 和 2 个回复 + Response 200 (application/xml) + Headers ETag: "Version2" + Body <Xml> <A> <B /> <C /> </A> </Xml> + Response 304 (application/xml) 我想要的是在此处指定描述(请注意+ Response行下的注释): + Response 200 (application/xml) In case if the resource hasn't changed + Headers ETag: "Version2" + Body <Xml> <A> <B /> <C /> </A> </Xml> + Response 304 (application/xml) In case if the resource has changed 是否可以? 回答1 目前没有办法在 API Blueprint 中表达这样的逻辑。 您始终可以在相应的响应中或在动作本身下“通过口”来描述它。 例如: # Resource [/1] ## Action [GET]

2021-08-12 04:41:43    分类:技术分享    rest   apiary.io   apiblueprint

MSON to describe object attributes in blueprint

I have an issue similar to what is described here. I have a JSON that looks like this: { "photos": [ { "key": "y37dmj10jkwof/moOIUB8912JKVgh", "caption": "A world of gamers.", "tags": [ "game", "japan" ], "attributes": { "copyright": true, "use": [ "public", "private" ] } } ] } and I am trying to describe the attributes using MSON, to render the blueprint. However, I am not successful at it. Here is my attempt: + Attributes (required, object) + photos (required, array) + (object) + key (required, string) - Photo key + caption (required, string) - Photo caption + tags (required, array) + game

2021-06-28 18:52:30    分类:问答    apiblueprint   apiary.io   apiary   MSON

Specify description for every response we have in Apiary.io

Is it possible to specify description for every response to some request? Suppose, we have a request ### Retrieve resource [GET] + Headers If-None-Match: "Version1" And 2 responses + Response 200 (application/xml) + Headers ETag: "Version2" + Body <Xml> <A> <B /> <C /> </A> </Xml> + Response 304 (application/xml) What I would like is to specify description like here (please note comments right under + Response lines): + Response 200 (application/xml) In case if the resource hasn't changed + Headers ETag: "Version2" + Body <Xml> <A> <B /> <C /> </A> </Xml> + Response 304 (application/xml) In

2021-06-14 17:52:39    分类:问答    rest   apiary.io   apiblueprint