在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:vasanthv/jsonbox开源软件地址:https://github.com/vasanthv/jsonbox开源编程语言:JavaScript 65.5%开源软件介绍:
jsonbox.ioA HTTP based JSON storage. It lets you store, read & modify JSON data over HTTP APIs for FREE. Ideal for small projects, prototypes or hackathons, where you don't have to spin up your own data store. With the new protected boxes (introduced in v2), you can even power your websites with jsonbox.io. API DocumentationBase URL: CreateYou can create a record (or add a record) to a box by using HTTP post to curl -X POST 'https://jsonbox.io/demobox_6d9e326c183fde7b' \
-H 'content-type: application/json' \
-d '{"name": "Jon Snow", "age": 25}' Response: {
"_id": "5d776a25fd6d3d6cb1d45c51",
"name": "Jon Snow",
"age": 25,
"_createdOn": "2019-09-10T09:17:25.607Z"
} You can also create multiple records at once by passing an array curl -X POST 'https://jsonbox.io/demobox_6d9e326c183fde7b' \
-H 'content-type: application/json' \
-d '[{"name": "Daenerys Targaryen", "age": 25}, {"name": "Arya Stark", "age": 16}]' [
{
"_id": "5d776b75fd6d3d6cb1d45c52",
"name": "Daenerys Targaryen",
"age": 25,
"_createdOn": "2019-09-10T09:23:01.105Z"
},
{
"_id": "5d776b75fd6d3d6cb1d45c53",
"name": "Arya Stark",
"age": 16,
"_createdOn": "2019-09-10T09:23:01.105Z"
}
] You can also pass in an optional collections parameter in the URL to group records Note: A valid ReadUse HTTP GET to read all the records or a single record. You can also query & sort the records. curl -X GET 'https://jsonbox.io/demobox_6d9e326c183fde7b' [
{
"_id": "5d776b75fd6d3d6cb1d45c52",
"name": "Daenerys Targaryen",
"age": 25,
"_createdOn": "2019-09-10T09:23:01.105Z"
},
{
"_id": "5d776b75fd6d3d6cb1d45c53",
"name": "Arya Stark",
"age": 16,
"_createdOn": "2019-09-10T09:23:01.105Z"
},
{
"_id": "5d776a25fd6d3d6cb1d45c51",
"name": "Jon Snow",
"age": 25,
"_createdOn": "2019-09-10T09:17:25.607Z"
}
] To get all records inside a collection Sample collection name: "users": curl -X GET 'https://jsonbox.io/demobox_6d9e326c183fde7b/users' To sort the records by a specific field use curl -X GET 'https://jsonbox.io/demobox_6d9e326c183fde7b?sort=-age' To read a specific record use curl -X GET 'https://jsonbox.io/demobox_6d9e326c183fde7b/5d776a25fd6d3d6cb1d45c51' To query records, you have to pass the key & value as shown below. curl -X GET 'https://jsonbox.io/demobox_6d9e326c183fde7b?q=name:arya%20stark' All the accepted query params are as follows.
FilteringYou can pass a filter in a query by passing them in URL param curl -X GET 'https://jsonbox.io/demobox_6d9e326c183fde7b?q=name:arya%20stark,age:>13' The above sample will look for the name Different filters for Numeric values.
Different filters for String values.
You can combine multiple fields by separating them with commas as shown below:
UpdateUse HTTP PUT to update record one by one. Please note that this will not patch the record, it is full update. A Bulk update is not supported yet. curl -X PUT 'https://jsonbox.io/demobox_6d9e326c183fde7b/5d776b75fd6d3d6cb1d45c53' \
-H 'content-type: application/json' \
-d '{"name": "Arya Stark", "age": 18}' DeleteTwo approaches are available for delete
curl -X DELETE 'https://jsonbox.io/demobox_6d9e326c183fde7b/5d776b75fd6d3d6cb1d45c53'
curl -X DELETE 'https://jsonbox.io/demobox_6d9e326c183fde7b?q=name:arya%20stark,age:>13' Protected BoxA protected box is similar to a regular box, but you need an API-KEY to create / update / delete records. Reading records is open and does not need API-KEY. Pass the API-KEY using the curl -X POST 'https://jsonbox.io/demobox_6d9e326c183fde7b' \
-H 'content-type: application/json' \
--H 'x-api-key: 7b3b910b-a7ad-41e8-89d6-5e28e2e34e70' \
-d '{"name": "Jon Snow", "age": 25}' You can also use How to create a protected box?You create a protected box by pushing your first record to a new box with an API-KEY. All the subsequent write requests to that box expect the API-KEY to be passed. You cannot change a public box to protected or vice versa. Getting Box metadataUse
The result will have the following format {
"_count": 3,
"_createdOn": "2020-03-12T04:45:22.000Z",
"_updatedOn": "2020-03-12T06:23:26.000Z"
}
Optional IP FilteringWhen running your own instance localy, you could define IP Address filtering. Single IP:
Using CIDR subnet masks for ranges:
Using IP ranges:
Using wildcard ip ranges and nginx forwarding:
LimitationsThis is FREE service, so we have to have some limitations to avoid abuse and stay free forever.
WrappersNote: The wrappers listed here are from other sources and have not been tested or validated by us
How to run locallyFork this repo and then clone it:
You need MongoDB to run this application. If you don't already have MongoDB, go to the official documentation and follow the instructions there. Once you have MongoDB installed, run
to start the MongoDB instance. Then
Then just run
to start the development server on port LICENSEMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论