POST /v2/patronages_reports
Create a patronages report
POST /v2/users/:user_id/patronages_reports
Create a patronages report for the given User
POST /v2/patronages/:patronage_id/patronages_reports
Create a patronages report for the given Patronage
POST /v2/reports/:report_id/patronages_reports
Create a patronages report for the given Report
live_help Notes
assignment
This action requires one of theses roles:
Tutor
settings Params
Param name | Description |
---|---|
user_id |
optional
. Must be String
The user id or slug |
patronage_id |
optional
. Must be String
The patronage id |
report_id |
optional
. Must be String
The report id or slug |
patronages_report | optional , nil allowed . Must be a Hash |
patronages_report[user_id] |
optional
, nil allowed
. Must be Fixnum
The user id. |
patronages_report[begin_at] |
optional
, nil allowed
. Must be DateTime
The begin at. |
patronages_report[patronage_id] |
required
. Must be Fixnum
The patronage id. |
patronages_report[report_id] |
required
. Must be Fixnum
The report id. |
patronages_report[validated_at] |
optional
, nil allowed
. Must be DateTime
The validated at. |
patronages_report[comment] |
optional
, nil allowed
. Must be String
The comment. |
patronages_report[answers_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The answers attributes. |
patronages_report[answers_attributes][question_id] |
required
. Must be Fixnum
The question id. Must be unique in the scope of a given scalable entity. |
patronages_report[answers_attributes][value] |
optional
, nil allowed
. Must be Fixnum
The value. |
patronages_report[answers_attributes][answer] |
optional
, nil allowed
. Must be String
The answer. |
patronages_report[answers_attributes][id] |
optional
, nil allowed
. Must be Fixnum
The id. |
Examples
POST /v2/patronages_reports
{
"patronages_report": {
"begin_at": "2017-11-22 13:43:10 UTC",
"patronage_id": "98",
"report_id": "0",
"user_id": "27"
}
}
201
{
"id": 127,
"user_id": 27,
"begin_at": "2017-11-22T13:43:10.000Z",
"created_at": "2017-11-22T13:43:51.496Z",
"updated_at": "2017-11-22T13:43:51.496Z",
"patronage_id": 98,
"report_id": 0,
"validated_at": null,
"patronage": {
"id": 98,
"user_id": 107,
"godfather_id": 96,
"ongoing": true,
"created_at": "2017-11-22T13:42:12.541Z",
"updated_at": "2017-11-22T13:43:51.499Z"
},
"report": {
"id": 0,
"name": "Final Debriefing",
"comment": "",
"introduction_md": "",
"disclaimer_md": "",
"guidelines_md": "Schlitz stumptown tacos locavore ennui chartreuse pork belly. Polaroid vice readymade everyday next level. Jean shorts venmo cold-pressed crucifix.\nRamps truffaut tousled biodiesel sriracha shoreditch ugh actually. Celiac street sartorial normcore gentrify chia fingerstache photo booth. Vinyl next level locavore stumptown truffaut vice.\nEveryday keffiyeh pinterest flannel. Five dollar toast yr listicle trust fund franzen salvia. Humblebrag umami aesthetic pour-over blog before they sold out. Humblebrag occupy deep v.",
"created_at": "2017-11-22T13:42:11.309Z",
"updated_at": "2017-11-22T13:42:11.416Z",
"slug": "final-debriefing",
"delay_days": 210
},
"user": {
"id": 27,
"login": "dcaedus",
"url": "https://api.intra.42.fr/v2/users/dcaedus"
},
"answers": []
}
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"patronages_report":{"begin_at":"2017-11-22 13:43:10 UTC","patronage_id":"98","report_id":"0","user_id":"27"}}' "https://api.intra.42.fr/v2/patronages_reports"
{
"id": 127,
"user_id": 27,
"begin_at": "2017-11-22T13:43:10.000Z",
"created_at": "2017-11-22T13:43:51.496Z",
"updated_at": "2017-11-22T13:43:51.496Z",
"patronage_id": 98,
"report_id": 0,
"validated_at": null,
"patronage": {
"id": 98,
"user_id": 107,
"godfather_id": 96,
"ongoing": true,
"created_at": "2017-11-22T13:42:12.541Z",
"updated_at": "2017-11-22T13:43:51.499Z"
},
"report": {
"id": 0,
"name": "Final Debriefing",
"comment": "",
"introduction_md": "",
"disclaimer_md": "",
"guidelines_md": "Schlitz stumptown tacos locavore ennui chartreuse pork belly. Polaroid vice readymade everyday next level. Jean shorts venmo cold-pressed crucifix.\nRamps truffaut tousled biodiesel sriracha shoreditch ugh actually. Celiac street sartorial normcore gentrify chia fingerstache photo booth. Vinyl next level locavore stumptown truffaut vice.\nEveryday keffiyeh pinterest flannel. Five dollar toast yr listicle trust fund franzen salvia. Humblebrag umami aesthetic pour-over blog before they sold out. Humblebrag occupy deep v.",
"created_at": "2017-11-22T13:42:11.309Z",
"updated_at": "2017-11-22T13:42:11.416Z",
"slug": "final-debriefing",
"delay_days": 210
},
"user": {
"id": 27,
"login": "dcaedus",
"url": "https://api.intra.42.fr/v2/users/dcaedus"
},
"answers": []
}
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 = {patronages_report: {begin_at: "2017-11-22 13:43:10 UTC", patronage_id: "98", report_id: "0", user_id: "27"}}
response = token.post("/v2/patronages_reports", params: params)
response.status
# => 201
response.parsed
# => {"id"=>127, "user_id"=>27, "begin_at"=>"2017-11-22T13:43:10.000Z", "created_at"=>"2017-11-22T13:43:51.496Z", "updated_at"=>"2017-11-22T13:43:51.496Z", "patronage_id"=>98, "report_id"=>0, "validated_at"=>nil, "patronage"=>{"id"=>98, "user_id"=>107, "godfather_id"=>96, "ongoing"=>true, "created_at"=>"2017-11-22T13:42:12.541Z", "updated_at"=>"2017-11-22T13:43:51.499Z"}, "report"=>{"id"=>0, "name"=>"Final Debriefing", "comment"=>"", "introduction_md"=>"", "disclaimer_md"=>"", "guidelines_md"=>"Schlitz stumptown tacos locavore ennui chartreuse pork belly. Polaroid vice readymade everyday next level. Jean shorts venmo cold-pressed crucifix.\nRamps truffaut tousled biodiesel sriracha shoreditch ugh actually. Celiac street sartorial normcore gentrify chia fingerstache photo booth. Vinyl next level locavore stumptown truffaut vice.\nEveryday keffiyeh pinterest flannel. Five dollar toast yr listicle trust fund franzen salvia. Humblebrag umami aesthetic pour-over blog before they sold out. Humblebrag occupy deep v.", "created_at"=>"2017-11-22T13:42:11.309Z", "updated_at"=>"2017-11-22T13:42:11.416Z", "slug"=>"final-debriefing", "delay_days"=>210}, "user"=>{"id"=>27, "login"=>"dcaedus", "url"=>"https://api.intra.42.fr/v2/users/dcaedus"}, "answers"=>[]}