feusebio / restful-api-request
ApiRestClient 是一个简单的库,用于与 RESTful API 通信
Requires
- php: ^5.3.3
- nategood/httpful: 0.2.20
This package is not auto-updated.
Last update: 2024-09-23 07:54:42 UTC
README
ApiRestClient
ApiRestClient 是一个简单的库,用于与 API Rest 通信。
该项目是为了与 API CustoJusto.pt 进行通信而创建的,出于安全考虑,省略了一些数据。用户可以自由使用并修改以与其他 API 进行通信。
- 使用 Httpful Rest Client Lib (http://phphttpclient.com/)
- 使用最受欢迎的 HTTP 方法(GET/POST/UPDATE/DELETE)
- 执行 CRUD 操作
CURL 示例
curl -i -X POST "https://api......./v0/entries" -H "Authorization: Token token=XxxXXxxXxXXX" -H "Content-Type: application/json" -d ' { "title": "Escritório com 250m2 no Marquês", "description": "Fabuloso escritório com 250m2 no centro de Lisboa com ótimos acessos...", "type_id": "sell", "category_id": 1020, "image_ids": [13123123, 3123123, 231232, 2345356, 7867867], "location": { "region_id": 14, "zipcode": "1000", "area_id": 220 }, "partner_info": { "ad_id": "7", "group_id": "gg-45" }, "parameters": { "rooms": 6, "size": 25 } }'
获取数据 curl -i -X GET "https://apidev......./v0/types" -H "Authorization: Token token=XxxXXxxXxXXX"
列出条目 curl -i -X GET "https://apidev....../v0/entries/12495697" -H "Authorization: Token token=XxxXXxxXxXXX"