POST /v2/project_data
Create a project datum
live_help Notes
assignment
This action requires one of theses roles:
Advanced tutor
group_work
Requires following application scopes:
projects
Examples
POST /v2/project_data
{
"project_data": {
"by": "[[7, 3000, 1900, 3000, 1725], [36, 3000, 1725, 3100, 1725]]",
"coordinates": "[2350.0, 3450.0]",
"kind": "project",
"project_session_id": "5"
}
}
201
{
"id": 8,
"coordinates": [
2350.0,
3450.0
],
"by": [
[
7,
3000,
1900,
3000,
1725
],
[
36,
3000,
1725,
3100,
1725
]
],
"kind": "project",
"project_session_id": 5
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"project_data":{"by":"[[7, 3000, 1900, 3000, 1725], [36, 3000, 1725, 3100, 1725]]","coordinates":"[2350.0, 3450.0]","kind":"project","project_session_id":"5"}}' "https://api.intra.42.fr/v2/project_data"
{
"id": 8,
"coordinates": [
2350.0,
3450.0
],
"by": [
[
7,
3000,
1900,
3000,
1725
],
[
36,
3000,
1725,
3100,
1725
]
],
"kind": "project",
"project_session_id": 5
}
require "oauth2"
UID = "Your application uid"
SECRET = "Your application secret"
client = OAuth2::Client.new(UID, SECRET, site: "https://api.intra.42.fr")
token = client.client_credentials.get_token
params = {project_data: {by: "[[7, 3000, 1900, 3000, 1725], [36, 3000, 1725, 3100, 1725]]", coordinates: "[2350.0, 3450.0]", kind: "project", project_session_id: "5"}}
response = token.post("/v2/project_data", params: params)
response.status
# => 201
response.parsed
# => {"id"=>8, "coordinates"=>[2350.0, 3450.0], "by"=>[[7, 3000, 1900, 3000, 1725], [36, 3000, 1725, 3100, 1725]], "kind"=>"project", "project_session_id"=>5}