Before you begin!
Visit the Wetrocloud console to get your API key. If you have trouble obtaining it, refer to this guide.

Introduction

This guide is for developers looking to get started with the WetroCloud API quickly. Using simple cURL commands, you’ll learn how to:

  • Create a collection
  • Insert resources into the collection
  • Query resources for answers
  • Categorize resources

Prerequisites:

By the end, you’ll have queried your first resource using Wetrocloud API.

Important!
Always prefix your API key with Token (including a space). Example: Token YOUR_API_KEY. Requests without this format will be rejected.

1

Create a Collection

First, create a collection_id to group your resources.

curl --request POST \
--url https://api.wetrocloud.com/v1/create/ \
--header 'Authorization: Token <api-key>'
2

List all available collections

After creating a collection, you can get all your available collections on wetrocloud.

curl --request GET \
--url 'https://api.wetrocloud.com/v1/collection/' \
--header 'Authorization: Token <api-token>'
3

Insert a Resource into the Collection

Add a resource to your collection using the collection_id you created earlier

curl --request POST \
  --url https://api.wetrocloud.com/v1/insert/ \
  --header 'Authorization: Token <api-key>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'collection_id=<collection_id>' \
  --form 'resource=https://en.wikipedia.org/wiki/Elizabeth_II' \
  --form 'type=web'
4

Query a Resource

Query your resource using the collection_id created earlier by providing a query in the request_query field.

curl --request POST \
--url https://api.wetrocloud.com/v1/query/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form 'collection_id=<collection_id>' \
--form 'request_query=What is this all about?' \

To keep things simple we made use of the /query/ endpoint without structured output

5

Categorize a Resource

  curl --request POST \
--url https://api.wetrocloud.com/v1/category/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form 'resource=match review: John Cena vs. The Rock.' \
--form type=text \
--form 'json_schema={"label":"string" }' \
--form 'json_schema_rules=["never go out of context", "Categorize this data based on their types like football, coding, entertainment, basketball, wrestling, information, etc.", "Always return json", "Always return one word answers"]'
6

This endpoint is used to delete a collection

curl --request DELETE \
--url https://api.wetrocloud.com/v1/delete/ \
--header 'Authorization: Token <api-key>'

Great, that was easy!

If you want to get a more in depth understanding of how wetrocloud API fits together head on over to the API reference.