I would like to clarify what is the design standard to query a list of array.
json data:
"ids": [
{
"id": "bbbbeeee1111",
"type": "student"
},
{
"id": "bbbbeeee2222",
"type": "teacher"
}
],
GET endpoint
/api/testitem
swagger parameter body
{
"ids": ["bbbbeeee1111;student"]
}
swagger returned the URI like this , the %3B seems wrong. some coding issues at API design?
http://localhost:8888/api/testitem?ids=bbbbeeee1111%3Bstudent
Related
I can’t understand how to create the http body of the Modify User Account api:
PATCH
https://api.appstoreconnect.apple.com/v1/users/{id}
In particular the:
[UserUpdateRequest.Data.Relationships.VisibleApps.Data]
What are the required id and type properties of Data object? Could somebody provide a code or postman example of a request ?
This is the url of the topic:
Appstoreconnect Api - Update User
The PATCH request should look like this:
PATCH /v1/users/XXX
{
"data": {
"type": "users",
"id": "XXX",
"attributes": {
"allAppsVisible": false
},
"relationships": {
"visibleApps": {
"data": [
{"type": "apps", "id": "AAA"},
{"type": "apps", "id": "BBB"}
]
}
}
}
}
Where AAA and BBB are Apple IDs of your apps. You can find these on the App Information page, or in response to the /v1/apps API calls.
I'm producing a swagger for a simple api that returns an object which correctly generates the swagger response similar to the below. My question is, is it possible to change the definition from myCustomerMadeUpResponse to customerResponse.
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/myCustomerMadeUpResponse"
I'd like to use API Gateway as a proxy to S3. The bucket is keyed by a composite key made up of two parts like this: [userId]-[documentId].
UserId comes to API Gateway as a path parameter, documentId comes in as a request parameter, for example: [gateway-url]/user1?documentId=doc1
How can I combine the two so that the s3 lookup URL has the following format: https://[bucket-url]/user1-doc1?
Thank you.
Setup your Method Request to accept the path param {userid} and query param {docid}.
Setup your Integration Request to accept both method.request.querystring.docid and method.request.path.userid as URL path params.
Finally, setup your integration endpoint URL as https://your-url/{userid}-{docid}.
A swagger snippet for this is as follows-
"paths": {
"/concat-params/{userid}": {
"get": {
"parameters": [
{
"name": "userid",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "docid",
"in": "query",
"required": false,
"type": "string"
}
],
"responses": {...},
"x-amazon-apigateway-integration": {
"responses": {...},
"requestParameters": {
"integration.request.path.userid":"method.request.path.userid",
"integration.request.path.docid":"method.request.querystring.docid"
},
"uri": "https:.../{userid}-{docid}",
...
}
}
}
Hope this helps,
Ritisha.
In the json:api format relationships are defined with a type and a id.
Like in the example bellow. The article has a relationship with the type people and the id 9.
Now if i want to fetch the related resource i use the URI from "links.related"
// ...
{
"type": "articles",
"id": "1",
"attributes": {
"title": "Rails is Omakase"
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
},
"data": { "type": "people", "id": "9" }
}
},
"links": {
"self": "http://example.com/articles/1"
}
}
// ...
But in my case the related resource (people) are in a separate API. There is no way to get the full people data from the articles API nor is it possible to include it. The only way to get the related data would be a call to:
http://example.com/v1-2/people/9/
Where can i define the relation between the URI and people:9
Or in other words: How would a client know where to fetch the related resource?
I have a REST service that returns an array of Strings (i.e. not an object). The relevant Blueprint markdown from Apiary is as follows:
+ Model (application/json)
+ Body
[
"element1",
"element2",
"element3"
]
+ Schema
{
"type": "array",
"items": {
"type": "string"
}
}
When I run the mock service in Apiary it works, but I get the following error in apiary traffic inspector:
This API request was compared to a documented resource but was found invalid.
Check your request headers and body below.
...
JSON schema is not valid! invalid type: object (expected [object Object]/array)
at path "/items"
Is there a trick to get this working (a change to the markdown), or is this a bug with Apiary?
Apiary support JSON Schema draft 3, this using JSON schema generator - http://www.jsonschema.net/
{
"type":"object",
"$schema": "http://json-schema.org/draft-03/schema",
"id": "http://jsonschema.net",
"required":false,
"properties":{
"0": {
"type":"string",
"id": "http://jsonschema.net/0",
"required":false
},
"1": {
"type":"string",
"id": "http://jsonschema.net/1",
"required":false
},
"2": {
"type":"string",
"id": "http://jsonschema.net/2",
"required":false
}
}
}