在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:koemeet/JsonApiBundle开源软件地址:https://github.com/koemeet/JsonApiBundle开源编程语言:PHP 100.0%开源软件介绍:JsonApiBundleIntegration of JSON API with Symfony 2 (FOSRestBundle)
Usage
If you want to experiment with this implementation, you can just enable this bundle in your Configuration referencemango_json_api:
show_version_info: true # default
base_uri: /api # default Annotations@ResourceThis will define your class as a JSON-API resource, and you can optionally set it's type name.
use Mango\Bundle\JsonApiBundle\Configuration\Annotation as JsonApi;
/**
* @JsonApi\Resource(type="posts", showLinkSelf=true)
*/
class Post
{
// ...
}
@Id (optional, it defaults to |
Property | Default | Required | Content | Info |
---|---|---|---|---|
includeByDefault | false | No | boolean | This will include (sideload) the relationship with it's primary resource |
showData | false | No | boolean | Shows data , which consists of ids of the relationship data |
showLinkSelf | false | No | boolean | Add self link of the relationship |
showLinkRelated | false | No | boolean | Add related link of the relationship |
# app/config/config.yml
mango_json_api:
show_version_info: true
GET /api/channels
{
"jsonapi": {
"version": "1.0"
},
"meta": {
"page": 1,
"limit": 10,
"pages": 1,
"total": 4
},
"data": [
{
"type": "channels",
"id": 5,
"attributes": {
"code": "WEB-UK",
"name": "UK Webstore",
"description": null,
"url": "localhost",
"color": "Blue",
"enabled": true,
"created-at": "2015-07-16T12:11:50+0000",
"updated-at": "2015-07-16T12:11:50+0000",
"locales": [],
"currencies": [],
"payment-methods": [],
"shipping-methods": [],
"taxonomies": []
},
"relationships": {
"workspace": {
"data": {
"type": "workspaces",
"id": 18
}
}
}
},
{
"type": "channels",
"id": 6,
"attributes": {
"code": "WEB-NL",
"name": "Dutch Webstore",
"description": null,
"url": null,
"color": "Orange",
"enabled": true,
"created-at": "2015-07-16T12:11:50+0000",
"updated-at": "2015-07-16T12:11:50+0000",
"locales": [],
"currencies": [],
"payment-methods": [],
"shipping-methods": [],
"taxonomies": []
},
"relationships": {
"workspace": {
"data": {
"type": "workspaces",
"id": 18
}
}
}
},
{
"type": "channels",
"id": 7,
"attributes": {
"code": "WEB-US",
"name": "United States Webstore",
"description": null,
"url": null,
"color": "Orange",
"enabled": true,
"created-at": "2015-07-16T12:11:50+0000",
"updated-at": "2015-07-16T12:11:50+0000",
"locales": [],
"currencies": [],
"payment-methods": [],
"shipping-methods": [],
"taxonomies": []
},
"relationships": {
"workspace": {
"data": {
"type": "workspaces",
"id": 18
}
}
}
},
{
"type": "channels",
"id": 8,
"attributes": {
"code": "MOBILE",
"name": "Mobile Store",
"description": null,
"url": null,
"color": "Orange",
"enabled": true,
"created-at": "2015-07-16T12:11:50+0000",
"updated-at": "2015-07-16T12:11:50+0000",
"locales": [],
"currencies": [],
"payment-methods": [],
"shipping-methods": [],
"taxonomies": []
},
"relationships": {
"workspace": {
"data": {
"type": "workspaces",
"id": 18
}
}
}
}
],
"included": [
{
"type": "workspaces",
"id": 18,
"attributes": {
"name": "First Workspace"
},
"relationships": {
"channels": {
"links": {
"related": "/workspaces/18/channels"
}
}
}
}
]
}
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论