apiary.io

Create Mock Service API using Apiary

只谈情不闲聊 提交于 2019-12-06 10:34:45
问题 I'm attempting to create mock api services for testing purposes. We are already using Apiary on another team so I'm starting there. So far, I've noticed that if I want to have two separate calls requires mocking out of both requests. For example to get the notes with ids 1 and 2 requires explicitly writing out responses like: /notes/1 /notes/2 Is there a way to avoid this? Admittedly I'm still ramping up on creating blueprints. 回答1: Have a look at private-e9e59-pingdomcheck.apiary-mock.com/v1

Create Mock Service API using Apiary

不问归期 提交于 2019-12-04 16:26:16
I'm attempting to create mock api services for testing purposes. We are already using Apiary on another team so I'm starting there. So far, I've noticed that if I want to have two separate calls requires mocking out of both requests. For example to get the notes with ids 1 and 2 requires explicitly writing out responses like: /notes/1 /notes/2 Is there a way to avoid this? Admittedly I'm still ramping up on creating blueprints. Have a look at private-e9e59-pingdomcheck.apiary-mock.com/v1/gists/1 . The number 1 is {id} here. You of course get only the general defined response (like if I used id

Documenting query parameters with API Blueprint

自古美人都是妖i 提交于 2019-12-04 16:19:00
问题 I'm trying to document a query parameter in API Blueprint, but I'm not entirely sure if I have done it correctly. The resource looks like this: DELETE http://baasar.apiary-mock.com/user/{appId}/{userId} That request would deactivate the user while the following would delete the user object: DELETE http://baasar.apiary-mock.com/user/{appId}/{userId}?force=true This is the Blueprint markdown I have for this: ## User [/user/{appId}/{userId}] Handle user objects + Parameters + appId (required,

AngularJS and Apiary.IO - can't read any response headers?

点点圈 提交于 2019-12-04 11:33:46
I mocking my API using Apiary.io. But somehow I cannot read any headers from response object using angularJS. And I am sure i have at least Content-Type: application/json correctly set-up by checking in firebug. Code in Angular should read headers correctly too as i can print them when sending request to somewhere else than apiary.io... $http.get('http://ies.apiary.io/some').then(function(response) { console.log("ok",response.headers('Content-Type')); },function(response){console.log("err",response);}); http://plnkr.co/edit/zMO0pXGsIdJkV0fZdBdw It all boils down to a bug in firefox: https:/

Documenting query parameters with API Blueprint

左心房为你撑大大i 提交于 2019-12-03 10:17:06
I'm trying to document a query parameter in API Blueprint, but I'm not entirely sure if I have done it correctly. The resource looks like this: DELETE http://baasar.apiary-mock.com/user/{appId}/{userId} That request would deactivate the user while the following would delete the user object: DELETE http://baasar.apiary-mock.com/user/{appId}/{userId}?force=true This is the Blueprint markdown I have for this: ## User [/user/{appId}/{userId}] Handle user objects + Parameters + appId (required, number, `1`) ... Application ID (`appId`) + userId (required, number, `1`) ... Numeric `userId` of the

How do I document a multipart request with apiary?

廉价感情. 提交于 2019-12-03 05:40:42
问题 I want to document a multipart request like the following: Content-Length: 477 Content-Type: multipart/form-data; boundary=---BOUNDARY -----BOUNDARY Content-Disposition: form-data; name="image[file]"; filename="image.jpg" Content-Type: image/jpeg Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL

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

拜拜、爱过 提交于 2019-11-30 18:11:19
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

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

半世苍凉 提交于 2019-11-30 06:56:15
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

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

妖精的绣舞 提交于 2019-11-30 03:03:16
问题 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

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

人盡茶涼 提交于 2019-11-29 08:04:45
问题 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