How to create an enterprise for your project

Each fundraise, loan or project that users can invest in should be created with an enterprise.

The enterprise entity holds the name and address of the company or moral person that backs the fundraise, loan or project.

  1. Via API requests, you first create the enterprise and receive its new id,
  2. You then use enterprise_id when creating any new fundraise, loan or project, to link them to this enterprise.

In this tutorial, we will create an enterprise programmatically by sending their information to the corresponding API endpoint directly.

1 - A minimal new enterprise

Json payload example

Two fields are mandatory: the name of the enterprise and the id of the user who created it (see the section How to create a user).

    "name": "Project 9000",
    "user_creator_id": "5faabb1b-329d-419b-aa6f-7bb46c99e029"

Let's send it

We send the information as a PUT HTTP request with the addition of this simple json payload.
As usual, the request will need correct credentials built from your API key, API secret and the current timestamp (see Getting started page, under the section authorization headers).

To send the PUT request, you can use the following example snippets from your favourite language:

		        String etpCrudUrl = "";

        String name = "Project 9000";
        String uid = "5faabb1b-329d-419b-aa6f-7bb46c99e029";

        JsonNode enterprise = Json.newObject()
            .put("name", name)
            .put("user_creator_id", uid);

        // see the "getting started" example to fill the headers
        // Map<String, String> yourHeaders = new HashMap(...)

        HttpResponse result = WS.url(etpCrudUrl).headers(yourHeaders).put(enterprise);
        String result = result.getString();

		        var request = require("request");

        var etpCrudUrl = "";

        // see the "getting started" example to fill the headers
        // var yourHeaders = {...};

            url: etpCrudUrl,
            body: {
                "name": "Project 9000",
                "user_creator_id": "5faabb1b-329d-419b-aa6f-7bb46c99e029"
            headers: yourHeaders,
            json: true
        }, function(error, response, body){

		        #! /usr/bin/env python3
        import requests

        etp_crud_url = ""

        # see the "getting started" example to fill the headers
        # your_headers = {...}

        resp = requests.put(
            json = {"name": "Project 9000", "user_creator_id": "5faabb1b-329d-419b-aa6f-7bb46c99e029"},
            headers = your_headers

		        $ch = curl_init();
        $data_json = json_encode(
                        array('name'=>'Project 9000'),

        $etp_crud_url = '';

        // see the "getting started" example to fill the headers
        // $your_headers = [...];

        curl_setopt($ch, CURLOPT_URL, $etp_crud_url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
        curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $your_headers);
        $server_output  = curl_exec($ch);
        echo $server_output;

NB: The created enterprise is automatically associated with your platform because of the API key that was used.

HTTP Response and enterprise ID

If your request was correct you will receive the following response:

    "id": "fa7e65728-3bc8-43d3-80f2-78c7f1a6bb3e",
    "created_at": "2018-02-12T12:21:19Z",
    "name": "Project 9000",
    "address": {}

The first line is the UUID of the new enterprise in DB and created_at records the timestamp of your action.

2 - Extension possibilities

Let's try a more complete enterprise.

Full enterprise json payload example

    "name": "Project 9000",
    "user_creator_id": "5faabb1b-329d-419b-aa6f-7bb46c99e029",
    "activity_domain": "science, health",
    "legal_status": "MORAL",
    "share_price": 10000,
    "description_short": "Startup de diffusion des NTIC pour la santé",
    "logo_url": "",
    "image_cover_url": "",
    "video_url": "",
    "website_url": "",
    "status": "SUBMITTED",
    "address": {"number": "100",
                "street": "rue Petit",
                "zip": "75019",
                "city": "Paris",
                "country": "France"}

The code to send this information is exactly the same as the previous minimal example.
And like before, the API replies with a brand new UUID for the new enterprise.


3 - Other related endpoints

Finally, any enterprise creation also triggers a recorded event (with the name: enterprise_created). These events can be searched or connected to any actions in a third-party API via the webhook endpoint.