< Extension:CampaignEvents

This page lists all endpoints available for the Extension:CampaignEvents extension. Note that all POST, PUT, and DELETE endpoints can be used either with the OAuth extension authorization process, or with cookie-based authentication. If using cookie-based authentication, the request body should contain a CSRF token, specified as "token": "token-goes-here". To get a CSRF token, see the Action API.

Enable an event registration

Route /campaignevents/v0/event_registration Content type application/json Method POST
Returns JSON object:
{ "id": "<ID of the registration (integer)>" }

Enables an event registration. The performer of the request is also automatically added as event organizer.

Request schema

event_page

required | title

Title of the associated event page. Must be a page on the current wiki.
chat_url

optional | string

Invite link for a chat group
tracking_tool_id

optional | string

ID of a tracking tool to link to the event. Currently, the only supported tool is the Programs & Events Dashboard, whose ID is wikimedia-pe-dashboard.
tracking_tool_event_id

optional | string

Identifier of this event within the tracking tool specified. For the Programs & Events Dashboard, this corresponds to the course slug (e.g., "Institution/CourseName").
timezone

required | string

Timezone identifier to use with the start and end time, in any format accepted by PHP.
start_time

required | timestamp

Timestamp of the event start time, in MW format (e.g., "20220414160000"), local time
end_time

required | timestamp

Timestamp of the event start time, in MW format (e.g., "20220414160000"), local time
online_meeting

optional | boolean

Whether the event is online
inperson_meeting

optional | boolean

Whether the event is in-person
meeting_url

optional | string

For online events, the URL of the video call
meeting_country

optional | string

For in-person events, the country where the event takes place
meeting_address

optional | string

For in-person events, the full address where the event takes place

Responses

201 Success: the event registration was enabled. The Location header shall point to the registration reource.
400 The event data is invalid
400 The provided CSRF token does not match
403 You cannot enable event registrations
403 You cannot enable event registration for the given event page

Edit an event registration

Route /campaignevents/v0/edit_event_registration Content type application/json Method PUT
Returns Nothing

Edits an event registration.

Parameters

id

required | integer

ID of the event registration

Request schema

event_page

required | title

Title of the associated event page. Must be a page on the current wiki.
status

required | string

Status of the event ("open", "closed")
chat_url

optional | string

Invite link for a chat group
tracking_tool_id

optional | string

ID of a tracking tool to link to the event. Currently, the only supported tool is the Programs & Events Dashboard, whose ID is wikimedia-pe-dashboard.
tracking_tool_event_id

optional | string

Identifier of this event within the tracking tool specified. For the Programs & Events Dashboard, this corresponds to the course slug (e.g., "Institution/CourseName").
timezone

required | string

Timezone identifier to use with the start and end time, in any format accepted by PHP.
start_time

required | timestamp

Timestamp of the event start time, in MW format (e.g., "20220414160000"), local time
end_time

required | timestamp

Timestamp of the event start time, in MW format (e.g., "20220414160000"), local time
online_meeting

optional | boolean

Whether the event is online
inperson_meeting

optional | boolean

Whether the event is in-person
meeting_url

optional | string

For online events, the URL of the video call
meeting_country

optional | string

For in-person events, the country where the event takes place
meeting_address

optional | string

For in-person events, the full address where the event takes place

Responses

204 Success: the event registration was edited.
400 The event data is invalid
400 The provided CSRF token does not match
400 The event page is not on another wiki, and the registration should be edited from there
403 You cannot edit event registrations
403 You cannot edit an event registration for the given event page
404 The given ID does not correspond to an existing event registration

List all events from an organizer

Route /campaignevents/v0/organizer/{userid}/event_registrations Content type application/json Method GET
Returns JSON object with an array of event registrations:
[
  { 
    "event_id": "<Id of the event (integer)>",
    "event_name": "<Name of the event>",
  }
]

If the event is deleted, there's an additional "event_deleted": true element.

Lists all the event registrations from an organizer.

Parameters

userid

required | integer

The central user ID of the organizer

Responses

201 Success: list all the events.
404 The user does not exist.

List all events a participant has registered for

Route /campaignevents/v0/participant/{userid}/event_registrations Content type application/json Method GET
Returns JSON object with an array of event registrations:
[
  { 
    "event_id": "<ID of the event (integer)>",
    "event_name": "<Name of the event>",
  }
]

If the event is deleted, there's an additional "event_deleted": true element.

Lists all the event registrations a participant has registered for.

Parameters

userid

required | integer

The central user ID of the participant

Responses

201 Success: list all the events.
404 The user does not exist.

Register as a participant

When using this endpoint on Wikimedia projects, you agree to the Terms of Use, Privacy Policy, Universal Code of Conduct, and any local Friendly Space Policy provided by the event organizers.
Route /campaignevents/v0/event_registration/{id}/participants/self Content type application/json Method PUT
Returns JSON object:
{ "modified": "<whether the action resulted in any modification (bool)>" }

Registers the user as a participant to an event.

Parameters

id

required | path

ID of the event registration

Request schema

is_private

required | boolean

Whether the registration should be private.

Responses

200 Success
400 The provided CSRF token does not match
400 The event registration is not open
400 The event has already ended
400 The event was deleted
403 You cannot register for events
404 The given ID does not correspond to an existing event registration

Cancel registration as a participant

Route /campaignevents/v0/event_registration/{id}/participants/self Content type application/json Method DELETE
Returns JSON object:
{ "modified": "<whether the action resulted in any modification (bool)>" }

Cancels the registration as a participant to an event.

Parameters

id

required | path

ID of the event registration

Responses

200 Success
400 The event has already ended
400 The provided CSRF token does not match
400 The event was deleted
403 You are not allowed to cancel your registration for this event
404 The given ID does not correspond to an existing event registration

Remove participants from an event

Route /campaignevents/v0/event_registration/{id}/participants Content type application/json Method DELETE
Returns JSON object:
{ "modified": "<number of removed participants (integer)>" }

Remove participant(s) from an event.

Parameters

id

required | path

ID of the event registration

Request schema

user_ids

optional | array

List of user ids to be removed, if omitted remove all. Passing an empty array will result in an error.

Responses

200 Success
400 The event has already ended
400 The provided CSRF token does not match
400 user_ids is an empty array
400 The event was deleted
403 You are not allowed to remove participants for this event
404 The given ID does not correspond to an existing event registration

Delete a registration

Route /campaignevents/v0/event_registration/{id} Content type application/json Method DELETE
Returns Nothing

Deletes an event registration.

Parameters

id

required | path

ID of the event registration

Responses

204 Success
400 The provided CSRF token does not match
403 You are not allowed to delete the registration
404 The given ID does not correspond to an existing event registration
404 The event registration is already deleted

List the organizers of an event

Route /campaignevents/v0/event_registration/{id}/organizers Content type application/json Method GET
Returns Array of objects:
{
  "organizer_id": "<organizer ID that can be passed as last_organizer_id>",
  "user_id": "<central ID (integer)>",
  "user_name": "<user name>",
  "roles": [ "creator", "organizer", ... ],
  "user_page": {
      "path": "<url to the user page",
      "title": "<url text for the user page link> ",
      "classes": "<css classes for the user page link generated by core>"
  },
}

Returns a list of organizers of a given event registration. This is hard-limited to 11 results.

Parameters

id

required | path

ID of the event registration
last_organizer_id

optional | query

Default null, if null get the first 11 organizers, if not null get next 11 organizers (this is not the user id)

Responses

200 Success
404 The given ID does not correspond to an existing event registration

List the participants of an event

Route /campaignevents/v0/event_registration/{id}/participants Content type application/json Method GET
Returns Array of objects, where each one has the following shape:
{
  "participant_id": "<participant ID that can be passed as last_participant_id>",
  "user_id": "<central user ID>",
  "user_registered_at": "<timestamp, in TS_MW format>",
  "user_registered_at_formatted": "<human-readable timestamp, formatted according to the user preferences>",
  "private": "<bool, whether the participant has registered privately>"
}

If the user is visible (and not deleted), the following properties will also be set:

{
  "user_name": "<user name>",
  "user_page": {
      "path": "<url to the user page",
      "title": "<url text for the user page link> ",
      "classes": "<css classes for the user page link generated by core>"
  }
}

Otherwise, the object will contain either "hidden": true or "not_found": true for accounts that were respectively hidden or couldn't be found.

Returns a list of participants of a given event registration. This is hard-limited to 20 results.

Parameters

id

required | path

ID of the event registration
include_private required | query Boolean, whether to include private participants in the result. The request will fail with a 403 error if the user is not allowed to view them.
last_participant_id optional | query Default null, if null get the first 20 participants, if not null get next 20 participants (this is not the user id)
username_filter optional | query String to filter participants by user_name

Responses

200 Success
403 include_private is true, but the user is not allowed to view private participants
404 The given ID does not correspond to an existing event registration

Get details of an event

Route /campaignevents/v0/event_registration/{id} Content type application/json Method GET
Returns JSON object with the same keys that you can use to edit a registration:
{
  "id": "<ID (integer)>",
  "name": "<name>",
  "event_page": "<event page title, prefixed with the localized namespace>",
  "event_page_wiki": "<ID of the wiki where the event page is located (string)>",
  "chat_url": "<url>",
  "tracking_tools": [
    {
      "tool_id": "<ID of the tool>",
      "tool_event_id": "<ID of the event within that tool>"
    }
  ],
  "status": "<status>",
  "timezone": "<TZ of the event, in any format accepted by PHP's DateTimeZone>",
  "start_time": "<timestamp in MW format, local time>",
  "end_time": "<timestamp in MW format, local time>",
  "online_meeting": "<whether the event is online (bool)>",
  "inperson_meeting": "<whether the event is in-person (bool)>",
  "meeting_url": "<url>",
  "meeting_country": "<country>",
  "meeting_address": "<address>",
  "questions": "<array with the IDs of enabled participant questions (integers)>"
}

Returns the details of a given event registration.

Parameters

id

required | path

ID of the event registration

Responses

200 Success
404 The given ID does not correspond to an existing event registration
404 The event registration was deleted

Update the list of organizers

Route /campaignevents/v0/event_registration/{id}/organizers Content type application/json Method PUT
Returns Nothing

Updates the list of organizers of a given event registration.

Parameters

id

required | path

ID of the event registration

Request schema

organizer_usernames

required | array

A list of local usernames

Responses

204 Success
400 organizer_usernames is an empty array
400 The list of organizers is invalid, which may happen for several reasons: users do not have a global account, you're trying to add more than 10 organizers, users are not allowed to be organizers, or you are removing the event creator but you're not allowed to do that.
403 You are not allowed to edit this event registration
404 The given ID does not correspond to an existing event registration

Get your registration information

Route /campaignevents/v0/event_registration/{id}/participants/self Content type application/json Method GET
Returns
{
  "private": "<whether you are registered privately (bool)>",
  "answers": [
    "<question ID (integer)>": [
      "option": "<chosen option (integer)>",
      "text": "<additional text>",
    ]
  ]
}

Returns the registration information of the current user as participant of a given event.

Parameters

id

required | path

ID of the event registration

Responses

200 Success
400 The user doesn't have a central account
404 The given ID does not correspond to an existing event registration
404 The user does not participate in the given event

Get available participant questions

Route /campaignevents/v0/participant_questions Content type application/json Method GET
Returns
{
  "<question ID (integer)>": {
    "name": "<human-readable name of the question>",
    "type": "<type of the question, one of 'radio', 'select', and 'text'>",
    "label": "<localized label of the question>",
    "options <(optional, only for radio and select)>": {
      "<localized text of the option>": "<corresponding value (integer)>"
    },
    "other-options <(optional, and can only be present for radio and select types)>": {
      "<option value for which this option is accepted (integer)>": {
        "type": "<type of the option, can only be 'text'>",
        "label": "<localized label of the option>"
      }
    }
  }
}

Returns the list of available participant questions.

Parameters

question_ids

optional | query

Only include questions with the given IDs. Unrecognized IDs are ignored.

Responses

200 Success
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.