How to create an operation with an enterprise
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.
- Via API requests, you first create the enterprise and receive its new
id
, - You then use
enterprise_id
when creating any new fundraise, loan or project, to link them to this enterprise.
- You can also create create enterprise when starting new fundraises or projects directly via the web interfaces.
- On your platform, by clicking "New Project" in your own fundraises list.
- For loan-equity platforms, in the admin platform , when clicking "NEW PROJECT" in the deals list.
- In the web interfaces, fundraise, loan or project creation usually creates a new 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 = "https://test-api.particeep.com/enterprise";
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();
System.out.println(result);
var request = require("request");
var etpCrudUrl = "https://test-api.particeep.com/enterprise";
// see the "getting started" example to fill the headers
// var yourHeaders = {...};
request.put({
url: etpCrudUrl,
body: {
"name": "Project 9000",
"user_creator_id": "5faabb1b-329d-419b-aa6f-7bb46c99e029"
},
headers: yourHeaders,
json: true
}, function(error, response, body){
console.log(body);
});
#! /usr/bin/env python3
import requests
etp_crud_url = "https://test-api.particeep.com/enterprise"
# see the "getting started" example to fill the headers
# your_headers = {...}
resp = requests.put(
url,
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'),
array('user_creator_id'=>'5faabb1b-329d-419b-aa6f-7bb46c99e029'
);
$etp_crud_url = 'https://test-api.particeep.com/enterprise';
// 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);
curl_close($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.
- Our object model provides many possible fields of information related to the enterprise.
-
The mandatory elements from step 1:
name and user_creator_id -
Address information (all fields are optional)
number, street, zip, city, region, country -
Company information
activity_domain, legal_status, share_price -
Links to the pictures and videos used to describe your company
url, logo_url, image_cover_url, video_url, website_url, -
Detailed information
description_short, description_long
-
The mandatory elements from step 1:
-
Additionally, we allow 2 free fields for any tags and custom json information you or your developper team may want to add.
- tags
- custom
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": "https://an.url.to/your/displayed/logo",
"image_cover_url": "https://an.url.to/your/background/image",
"video_url": "https://an.url.to/your/background/image",
"website_url": "https://your.company.com",
"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.
Remarks
- The image_cover_url is the background used to display images in each related project, fundraise or loan.
- The logo_url is also used in each related project, fundraise or loan.
- The activity domain is also sometimes used to tag the project itself.
3 - Other related endpoints
- All endpoints related to projects, fundraises or loans should refer to an enterprise by their
enterprise_id
field. - The
fundraise_search
endpoint provides search criteria for the enterprise of each project, fundraise or loan - The
capitalization
endpoint also refers to the related enterprise (allowing participation in company shares)
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.