Make a post request to /data
endpoint with any data you need to.
curl -X POST \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
}
}'
Response:
HTTP Status: 201 Created
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X POST \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'content-type: multipart/form-data' \
-F key=key_non_json \
-F value=non_json_data_to_store
Response:
HTTP Status: 201 Created
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"key": "key_non_json",
"value": "non_json_data_to_store",
"uuid": "0a53c6e7-7f77-4069-b7b0-e6c613b43682",
"deleted_at": null,
"created_at": "2023-06-04T23:19:50.453Z",
"updated_at": "2023-06-04T23:19:50.453Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X POST \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"key": "no_value_key",
"non_value_data_which_is_fine": {
"k1": "v1"
}
}'
Response:
HTTP Status: 201 Created
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"uuid": "acd44ccc-6b14-480f-ac6b-47bc138faa90",
"key": "no_value_key",
"value": {
"non_value_data_which_is_fine": {
"k1": "v1"
}
},
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X POST \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"value": "any_data"
}'
Response:
HTTP Status: 400 Bad Request
Body:
{
"_metadata": {
"result": "invalid_data",
"debug_message": "Data posted was invalid."
},
"item": null
}
curl -X POST \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{}'
Response:
HTTP Status: 400 Bad Request
Body:
{
"_metadata": {
"result": "invalid_data",
"debug_message": "Data posted was invalid."
},
"item": null
}
curl -X POST \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"key": "key_to_fetch_data_later",
"value": "data to store"
}'
Response:
HTTP Status: 400 Bad Request
Body:
{
"_metadata": {
"result": "non_unique_key",
"debug_message": "Non unique key was posted. Previously stored key/value has been returned."
},
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X POST \
https://randapis.com/data \
-H 'Authorization: Bearer incorrect_token' \
-H 'Content-Type: application/json' \
-d '{
"key": "a_unique_key_without_proper_auth",
"value": "data..."
}'
Response:
Body:
HTTP Status: 401 Unauthorized
HTTP **Response:** HTTP Token: Access denied.
curl -X GET \
'https://randapis.com/data?key=key_to_fetch_data_later' \
-H 'Authorization: Bearer {{YOUR_API_KEY}}'
Response:
HTTP Status: 200 OK
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X GET \
'https://randapis.com/data?id=ccd44ccc-6b14-480f-ac6b-47bc138faf90' \
-H 'Authorization: Bearer {{YOUR_API_KEY}}'
Response:
HTTP Status: 200 OK
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X GET \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}'
Response:
HTTP Status: 200 OK
Body:
{
"_metadata": {
"result": "success"
},
"_items_metadata": {
"item_count": 2,
"first_item_created_at": "2023-05-27T17:00:17.215Z",
"last_item_created_at": "2023-06-10T22:12:40.226Z"
},
"items": [
{
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
},
{
"item": {
"uuid": "6cf40f09-a3fa-4f17-a21d-6df21ebcfc55",
"key": "k1",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"retrievals": 1,
"retrieved_at": "2023-06-10T22:12:40.226Z",
"deleted_at": null,
"created_at": "2023-06-10T22:12:40.226Z",
"updated_at": "2023-06-10T22:12:40.226Z"
}
}
]
}
curl -X GET \
'https://randapis.com/data?key=invalid_key' \
-H 'Authorization: Bearer {{YOUR_API_KEY}}'
Response:
HTTP Status: 404 Not Found
Body:
{
"_metadata": {
"result": "not_found"
},
"item": null
}
curl -X GET \
'https://randapis.com/data?id=4c77fa40-6e9b-49e9-' \
-H 'Authorization: Bearer {{YOUR_API_KEY}}'
Response:
HTTP Status: 404 Not Found
Body:
{
"_metadata": {
"result": "not_found"
},
"item": null
}
Data before update:
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X PATCH \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"key": "key_to_fetch_data_later",
"value": "updated_text_value"
}'
Data before update:
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X PATCH \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'content-type: multipart/form-data; boundary' \
-F key=key_to_fetch_data_later \
-F value=updated_value_thru_form_data
Response:
HTTP Status: 200 OK
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"value": "updated_value_thru_form_data",
"key": "key_to_fetch_data_later",
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:38:10.142Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
Data before update:
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X PATCH \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"id": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"value": "updated_via_id"
}'
Response:
HTTP Status: 200 OK
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"value": "updated_via_id",
"key": "key_to_fetch_data_later",
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:41:31.463Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
Data before update:
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"key": "key_to_fetch_data_later",
"value": {
"k1": "v1",
"k2": "v2",
"k3": "v3"
},
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:00:17.215Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X PATCH \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'content-type: multipart/form-data;' \
-F value=updated_value_thru_form_data_id_ii \
-F id=0576a664-2749-41ed-9518-843b3f67fcfc
Response:
HTTP Status: 200 OK
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"value": "updated_via_id",
"key": "key_to_fetch_data_later",
"uuid": "ccd44ccc-6b14-480f-ac6b-47bc138faf90",
"deleted_at": null,
"created_at": "2023-05-27T17:00:17.215Z",
"updated_at": "2023-05-27T17:41:31.463Z",
"retrievals": 1,
"retrieved_at": "2023-06-04T23:53:18.431Z"
}
}
curl -X PATCH \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"key": "invalid",
"value": "updated_text_value"
}'
Response:
HTTP Status: 404 Not Found
Body:
{ "_metadata": {
"result": "not_found"
},
"item": null
}
curl -X PATCH \
https://randapis.com/data \
-H 'Authorization: Bearer {{YOUR_API_KEY}}' \
-H 'Content-Type: application/json' \
-d '{
"id": "invalid_id",
"value": "updated_text_value"
}'
Response:
HTTP Status: 404 Not Found
Body:
{ "_metadata": {
"result": "not_found"
},
"item": null
}
curl -X DELETE \
'http://localhost:3000/data?key=key_non_json2' \
-H 'Authorization: Bearer da65a6b64be26342072fc1eb460f69e7' \
-H 'Content-Type: application/json'
Response:
HTTP Status: 200 Success
Body:
{
"_metadata": {
"result": "success"
},
"item": {
"uuid": "938dba21-f62f-4ec9-890f-ecbc88d376a8",
"key": "key_non_json2",
"value": "non_json_data_to_store2",
"retrievals": 1,
"retrieved_at": "2023-06-07T02:21:32.585Z",
"deleted_at": "2023-10-17T10:59:56.712Z",
"created_at": "2023-06-07T02:21:32.585Z",
"updated_at": "2023-10-17T10:59:56.713Z"
}
}