# Introduction

Read the documentation for the Robobot API carefully if you plan to implement conversational form models in your application.


# Basics

Robobot aims to deliver a developer friendly approach for integrating conversational forms, created through the Robobot Dashboard, in existing software products.

## HTTP Methods

Robobot API can be integrated easily with any existing HTTP client using a variety of programming languages and frameworks. The API currently only supports POST requests that need some headers for authentication and formatting purposes.

## JSON

All Robobot API endpoints return JSON formatted data. POST actions need to be provided JSON formatted request bodies. These bodies should follow a schema as provided by the API reference.

Please note that we require each POST request to include the HTTP header Content-Type with its value set to application/json.

```
curl "https://api.robobot.app/client/entry/submit/<form_id>" \
    -X "POST" \
    -H "Content-Type: application/json"
```

{% hint style="info" %}
&#x20;Super-powers are granted randomly so please submit an issue if you're not happy with yours.
{% endhint %}

## Authentication

Robobot API has a custom authentication mechanism. It involves including a non-default HTTP header named "ApiCode" with your API requests. Provide your personal ApiCode formatted as xxxx in this header to open up requests to your forms. Use the "AccessCode" header and populate it with an accesscode to group answer data. We call grouped answers an entry.

An example of a curl request could look like this. Make sure to replace the XXX...X with your obtained access code and provide a form\_id. Dive into the API reference to see how you generate your own access code.

```
curl "https://api.robobot.app/client/entry/submit/<form_id>" \
    -X "POST" \
    -H "Content-Type: application/json" \
    -H "ApiCode: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx"
    -H "AccessCode: XXXXXXXXXXXXXXX"
```


# API Reference

This reference can help you explore the Robobot API with your own data.

## Create Entry

<mark style="color:green;">`POST`</mark> `https://api.robobot.app/client/entry/create/:id`

#### Path Parameters

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| id   | string | ID of the form. |

#### Request Body

| Name      | Type   | Description                     |
| --------- | ------ | ------------------------------- |
| email     | string | E-mail of the entry contact.    |
| lastName  | string | Last name of the entry contact. |
| firstName | string | First name of the entry contact |

{% tabs %}
{% tab title="200 " %}

```
{
  accessCode: "XXXXXXXXXXXXXXX"
}
```

{% endtab %}
{% endtabs %}

## Get Form

<mark style="color:blue;">`GET`</mark> `https://api.robobot.app/client/form/get/:id`

Request this endpoint to retrieve the form data for a certain form\_id. allows you to get free cakes.

#### Path Parameters

| Name | Type   | Description                                |
| ---- | ------ | ------------------------------------------ |
| id   | string | ID of the cake to get, for free of course. |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
    form: {
        id: 1,
        title: "Mauris mattis",
        background: "#3a87fe",
        buttons: "#ffab01",
        description: "Mauris mattis mi eu suscipit mollis.",
        gaTrackingCode: null,
        image: null,
        allowOpenEntry: true,
        allowAnonymousEntry: true,
        updated: 1581677549
    },
    next: ...
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
{    "message": "An error occured."}
```

{% endtab %}
{% endtabs %}

## Submit Answer

<mark style="color:blue;">`GET`</mark> `https://api.robobot.app/client/entry/submit/:id`

#### Path Parameters

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| id   | string | ID of the form. |

#### Request Body

| Name        | Type   | Description                          |
| ----------- | ------ | ------------------------------------ |
| element\_id | number | 31 (input-number)                    |
| element\_id | string | "1" (input-options, single)          |
| element\_id | string | \["1","2"] (input-options, multiple) |
| element\_id | string | \[ ]  (static-text)                  |

{% tabs %}
{% tab title="200 Example response for static-text element." %}

```
{
    form: ...
    next: {
        id: 122
        title: "Mauris mattis mi eu suscipit mollis!"
        type: "static-text"
        params: {
            body: "Aliquam cursus leo ac fringilla congue. Cras elementum euismod malesuada. Donec mauris dui, commodo ac felis et, blandit efficitur enim."
        }
    },
}
```

{% endtab %}
{% endtabs %}


