PATCH /v2/locations/:id
Update a location
PUT /v2/locations/:id
Update a location
PATCH /v2/users/:user_id/locations/:id
Update a location for the given Id, associated with the given User
PUT /v2/users/:user_id/locations/:id
Update a location for the given Id, associated with the given User
live_help Notes
assignment
This action requires one of theses roles:
Basic staff
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
user_id |
optional
. Must be String
The user id or slug |
location | optional , nil allowed . Must be a Hash |
location[user_id] |
optional
. Must be Fixnum
The user id. |
location[begin_at] |
optional
. Must be Fixnum
The begin at. . |
location[end_at] |
optional
, nil allowed
. Must be Fixnum
The end at. . |
location[primary] |
optional
, nil allowed
. Must be one of: true , false .
Is it primary ? |
location[host] |
optional
. Must be String
The host. Must be unique in the scope of a given campus id and end at. |
location[campus_id] |
optional
. Must be Fixnum
The campus id. |
Examples
PUT /v2/locations/4
{
"location": {
"begin_at": "2017-11-22 11:43:10 UTC",
"campus_id": "1",
"host": "burrito",
"user_id": "49"
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"location":{"begin_at":"2017-11-22 11:43:10 UTC","campus_id":"1","host":"burrito","user_id":"49"}}' "https://api.intra.42.fr/v2/locations/4"
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 = {location: {begin_at: "2017-11-22 11:43:10 UTC", campus_id: "1", host: "burrito", user_id: "49"}}
response = token.put("/v2/locations/4", params: params)
response.status
# => 204
response.parsed
# =>