mvogelgesang / data_gov_admin_api
连接到 api.data.gov API 网罩的简单 PHP SDK。
dev-master
2015-03-08 01:02 UTC
Requires
- php: >=5.3.0
- guzzlehttp/guzzle: ~5.0
This package is not auto-updated.
Last update: 2024-10-02 07:42:32 UTC
README
连接到 api.data.gov API 网罩的简单 PHP SDK。
先决条件
安装
- 克隆仓库
- 运行
composer install
示例
创建客户端
$client = new ApiDataGovClient('apiKey','adminAuthToken');
获取用户
$response = $client->getUsers();
响应
{
"draw": 0,
"recordsTotal": 5323,
"recordsFiltered": 5323,
"data": [
{
"created_at": "2013-05-02T18:53:42Z",
"created_by": null,
"deleted_at": null,
"disabled_at": null,
"email": "emailAddress1@example.gov",
"first_name": "John",
"last_name": "Doe",
"registration_source": "web",
"roles": null,
"throttle_by_ip": null,
"updated_at": "2014-01-20T12:59:02Z",
"updated_by": null,
"use_description": "",
"version": 3,
"website": null,
"api_key_preview": "string...",
"id": "long-hash-String"
},
{
"created_at": "2012-06-28T02:54:37Z",
"created_by": null,
"deleted_at": null,
"disabled_at": null,
"email": "emailAddress@example.gov",
"first_name": "Jane",
"last_name": "Doe",
"registration_source": "web",
"roles": null,
"throttle_by_ip": null,
"updated_at": "2014-01-20T12:59:02Z",
"updated_by": null,
"use_description": "",
"version": 3,
"website": "http://gsa.gov",
"api_key_preview": "string...",
"id": "long-hash-String"
},
....
]
}
获取用户
$users = $client->getUser('unique-user-id');
响应
{
"user": {
"id": "unique-user-id",
"api_key_preview": "string...",
"first_name": "John",
"last_name": "Doe",
"email": "example.email@example.com",
"website": null,
"use_description": "here is a description",
"registration_source": "web_admin",
"throttle_by_ip": false,
"roles": [
"api_write"
],
"enabled": true,
"created_at": "2015-02-19T16:08:21Z",
"updated_at": "2015-02-19T16:08:21Z",
"settings": {
"id": "hash-string",
"rate_limit_mode": null,
"allowed_ips": null,
"allowed_referers": null,
"rate_limits": []
},
"creator": {
"username": "creator@example.gov"
},
"updater": {
"username": "creator@example.gov"
}
}
}