REST API Full Reference

Read

get - GET

Gets a value from Socketize database against a key.

Arguments

key

Response

Value, as it was stored. Null if key doesn't exist.

Example

curl "https://socketize.com/api/get?key=name" \
 -X GET \
 -u your_public_key:your_private_key \
 -H "Accept: application/vnd.socketize.v1+json"

get_list_items - GET

Gets the values/items from the list against a key.

Arguments

key - the identifier of the list.

Response

Array of list items. Null if key doesn't exist.

Example

curl "https://socketize.com/api/get_list_items?key=list_name" \
 -X GET \
 -u your_public_key:your_private_key \
 -H "Accept: application/vnd.socketize.v1+json"

search_list - GET

Gets the values/items from the list against a key.

Arguments

key - the identifier of the list.

query - A properly stringifed JSON array of queries. like [["father","like","us%"],["name","!=","Firas"]]. Supported operators are =, !=, <, >, like, regex.

Response

Array of list items.

Example

curl "https://socketize.com/api/search_list?key=memberId:list_name&queries=[["father","like","us%"],["name","!=","Firas"]]" \
 -X GET \
 -u your_public_key:your_private_key \
 -H "Accept: application/vnd.socketize.v1+json"

Write

set - PUT

Arguments

Saves a value to Socketize database against a key.

key - a string to identify the value.

value - A string. JSON array or JSON object are also accepted but should be stringified properly, like: {"name":"Foo"}

Response

true

Example

curl "https://socketize.com/api/set/?key=memberId:friends&value={"name":"Usman"}" \
 -X PUT \
 -u your_public_key:your_private_key \
 -H "Accept: application/vnd.socketize.v1+json"

push_on_list - PUT

Appends the a value to the list, list is created if it doesn't exist.

Arguments

key - a string to identify the list.

value - JSON object(associative array) stringified properly, like: {"name":"Foo"}

Response

true

Example

curl "https://socketize.com/api/push_on_list/?key=gLwlMG:list_name&value={"name":"Foo"}" \
 -X PUT \
 -u your_public_key:your_private_key \
 -H "Accept: application/vnd.socketize.v1+json"

Realtime

publish - GET

Publishes data to event subscribers.

Arguments

channel (event name) - a string to identify the event.

data - data to be passed to subscribers, can be a string, JSON object or JSON array. In case JSON, it should be properly stringified.

Response

Total number of subscribers to the event

Example

curl "https://socketize.com/api/publish?channel=a_channel&value=Hi" \
 -X GET \
 -u your_public_key:your_private_key \
 -H "Accept: application/vnd.socketize.v1+json"

user/{emailOrUsername} - GET

Finds a user by email or username.

Arguments

None

Response

User details, like:

{
    "id": "gLwlMG",
    "email": "example@example.com",
    "username": "username",
    "created_at": "2015-06-14 11:47:17",
    "role": "Editor"
}

Example

curl "https://socketize.com/api/user/usernameOrEmail" \
 -X GET \
 -u your_public_key:your_private_key \
 -H "Accept: application/vnd.socketize.v1+json"

user - POST

Creates a user.

Arguments

email - Email address of the user.

username

password

Response

User details, like:

{
    "id": "gLwlMG",
    "email": "example@example.com",
    "username": "username",
    "created_at": "2015-06-14 11:47:17",
    "role": "Editor"
}

Example

curl "https://socketize.com/api/user?email=example@example.com&password=12345678&username=abcdefgh" \
 -X POST \
 -u your_public_key:your_private_key \
 -H "Accept: application/vnd.socketize.v1+json"