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 collection for answers
  • Chat with collection for conversations
  • Categorize resources
  • Remove resources
  • Delete Collection

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/collection/create/ \
    --header 'Authorization: Token <api-key>'
    --form 'collection_id=<collection_id>' \
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/all/ \
    --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/resource/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 Collection

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

  curl --request POST \
    --url https://api.wetrocloud.com/v1/collection/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 /collection/query/ endpoint without structured output

5

Chat with Collection

Chat with your collection using the collection_id created earlier by providing a message in the message field and continue conversations by passing chat_history.

  curl --request POST \
    --url https://api.wetrocloud.com/v1/collection/chat/ \
    --header 'Authorization: Token <api-key>' \
    --header 'Content-Type: multipart/form-data' \
    --form 'collection_id=<collection_id>' \
    --form 'message=Tell me more' \
    --form 'chat_history=[{"role":"user","content":"What is this all about?"}, {"role":"system","content":"This is about Queen Elizabeth_II of England"}]' \
6

Categorize a Resource

  curl --request POST \
    --url https://api.wetrocloud.com/v1/categorize/ \
    --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 'categories=["football", "coding", "entertainment", "basketball", "wrestling", "information"]'
7

Remove a Resource

This endpoint is used to delete a collection

  curl --request DELETE \
    --url https://api.wetrocloud.com/v1/resource/remove/ \
    --header 'Authorization: Token <api-key>'
    --form 'collection_id=<collection_id>' \
    --form 'resource_id=<resource_id>' \
8

Delete a Collection

This endpoint is used to delete a collection

  curl --request DELETE \
    --url https://api.wetrocloud.com/v1/collection/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.