Welcome to the Secrets API. This API allows you to manage and retrieve secrets anonymously. Please refer to the documentation below for details on how to interact with the API.
/generate-api-key
endpoint.
/get-auth-token
endpoint.
Registers a new user. If the username is already taken, it will return an error.
Request Body:
{
"username": "The username of the new user.",
"password": "The password of the new user."
}
Example Request:
POST https://secrets-api.appbrewery.com/register
{
"username": "jackbauer",
"password": "IAmTheBest"
}
Example Response:
{
"success": "Successfully registered."
}
Generates a new API key.
Example Request:
GET https://secrets-api.appbrewery.com/generate-api-key
Example Response:
{
"apiKey": "generated-api-key"
}
Generates an authentication token for a user. If the user does not exist or the password is incorrect, it will return an error.
Request Body:
{
"username": "The username of the registered user.",
"password": "The password of the registered user."
}
Example Request:
POST https://secrets-api.appbrewery.com/get-auth-token
{
"username": "jackbauer",
"password": "IAmTheBest"
}
Example Response:
{
"token": "generated-auth-token"
}
Returns a random secret. No authentication is required.
Example Request:
GET https://secrets-api.appbrewery.com/random
Example Response:
{
"id": "random-id",
"secret": "This is a random secret.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-01T12:34:56Z"
}
Returns all secrets, paginated. Basic authentication is required.
Query Parameters:
page
: The page number to retrieve.Example Request:
GET https://secrets-api.appbrewery.com/all?page=1
Example Response:
[
{
"id": "1",
"secret": "This is a secret.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-01T12:34:56Z"
},
{
"id": "2",
"secret": "Another secret.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-02T10:11:12Z"
}
// ... more secrets ...
]
Returns a random secret with a particular embarrassment score or higher. API key authentication is required.
Query Parameters:
apiKey
: Your API Key generated from the /generate-api-key
endpoint.score
: The minimum embarrassment score to filter by.Example Request:
GET https://secrets-api.appbrewery.com/filter?score=5&apiKey=b886c845-9989-43aa-8c60-ea4a669bb587
Example Response:
[
{
"id": "1",
"secret": "This is a secret with embarrassment score 5 or higher.",
"emScore": 5,
"username": "user123",
"timestamp": "2022-10-01T12:34:56Z"
},
{
"id": "2",
"secret": "Another secret with embarrassment score 5 or higher.",
"emScore": 7,
"username": "user123",
"timestamp": "2022-10-02T10:11:12Z"
}
// ... more secrets ...
]
Returns all the secrets of the authenticated user. Bearer token authentication is required.
Example Request:
GET https://secrets-api.appbrewery.com/user-secrets
Example Response:
[
{
"id": "1",
"secret": "This is a secret of the user.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-01T12:34:56Z"
},
{
"id": "2",
"secret": "Another secret of the user.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-02T10:11:12Z"
}
// ... more secrets ...
]
Returns the secret with the specified ID. Bearer token authentication is required.
URL Parameters:
id
: The ID of the secret to retrieve.Example Request:
GET https://secrets-api.appbrewery.com/secrets/1
Example Response:
{
"id": "1",
"secret": "This is a secret.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-01T12:34:56Z"
}
Adds a new secret. Bearer token authentication is required.
Request Body:
{
"secret": "This is a new secret.",
"score": "Embarrassment score"
}
Example Request:
POST https://secrets-api.appbrewery.com/secrets
{
"secret": "This is a new secret.",
"score": "Updated embarrassment score"
}
Example Response:
{
"id": "3",
"secret": "This is a new secret.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-03T08:15:00Z"
}
Updates the content of the secret with the specified ID. Bearer token authentication is required.
URL Parameters:
id
: The ID of the secret to update.Request Body:
{
"secret": "Updated secret content.",
"score": 5
}
Example Request:
PUT https://secrets-api.appbrewery.com/secrets/1
{
"secret": "Updated secret content",
"score": "Updated embarrassment score"
}
Example Response:
{
"id": "1",
"secret": "Updated secret content.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-01T12:34:56Z"
}
Partially updates the content of the secret with the specified ID. Bearer token authentication is required.
URL Parameters:
id
: The ID of the secret to update.Request Body:
{
"secret": "Updated secret content",
"score": "Updated embarrassment score"
}
Example Request:
PATCH https://secrets-api.appbrewery.com/secrets/1
{
"score": 2
}
Example Response:
{
"id": "1",
"secret": "Partially updated secret content.",
"emScore": 3,
"username": "user123",
"timestamp": "2022-10-01T12:34:56Z"
}
Deletes the secret with the specified ID. Bearer token authentication is required.
URL Parameters:
id
: The ID of the secret to delete.Example Request:
DELETE https://secrets-api.appbrewery.com/secrets/1
Example Response:
{
"message": "Secret with ID 1 has been deleted successfully."
}