swagger: "2.0"
schemes:
  - https
host: greenwire.greenpeace.org
basePath: /api/public
info:
  contact:
    name: Greenpeace International contact
    url: http://www.greenpeace.org/international/en/about/contactus/
    x-twitter: Greenpeace
  description: Greenpeace Greenwire allows you connect with other volunteers, activists and groups working on environmental campaigns all across the world!
  license:
    name: MIT
    url: http://opensource.org/licenses/MIT
  termsOfService: http://www.greenpeace.org/international/en/Help/copyright2/
  title: Greenwire Public API
  version: 1.0.0
  x-apisguru-categories:
    - collaboration
  x-logo:
    url: https://twitter.com/Greenpeace/profile_image?size=original
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/greenpeace/ggw_api_test/master/swagger.yaml
      version: "2.0"
  x-providerName: greenpeace.org
consumes:
  - application/json
produces:
  - application/json
paths:
  /events:
    get:
      description: Return the upcoming events (e.g. start date >= today). Gets an array of `Event` object. Mandatory query param of **domain** determines the site / country the event belongs to.
      parameters:
        - description: "the site the groups belongs to, example: netherlands"
          in: query
          name: domain
          required: true
          type: string
        - description: the number of desired records
          in: query
          name: limit
          required: false
          type: string
      responses:
        "200":
          description: Successful response
          schema:
            properties:
              body:
                items:
                  $ref: "#/definitions/Event"
                type: array
              header:
                $ref: "#/definitions/HeaderSuccess"
  "/events/{UUID}":
    get:
      description: Get one `Event` object by specifying its UUID in the url path.
      parameters:
        - in: path
          name: UUID
          required: true
          type: string
      responses:
        "200":
          description: Successful response
          schema:
            properties:
              data:
                $ref: "#/definitions/Event"
              header:
                $ref: "#/definitions/HeaderSuccess"
        "400":
          description: Not found
          schema:
            properties:
              body:
                type: object
              header:
                $ref: "#/definitions/HeaderError"
  /groups:
    get:
      description: Gets an array of `Group` object. Mandatory query param of **domain** determines the site / country the group belongs to.
      parameters:
        - description: "the site the groups belongs to, example: netherlands"
          in: query
          name: domain
          required: true
          type: string
        - description: the number of desired records
          in: query
          name: limit
          required: false
          type: string
      responses:
        "200":
          description: Successful response
          schema:
            properties:
              body:
                items:
                  $ref: "#/definitions/Group"
                type: array
              header:
                $ref: "#/definitions/HeaderSuccess"
  "/groups/{UUID}":
    get:
      description: Get one `Group` object by specifying its UUID in the url path.
      parameters:
        - in: path
          name: UUID
          required: true
          type: string
      responses:
        "200":
          description: Successful response
          schema:
            properties:
              data:
                $ref: "#/definitions/Group"
              header:
                $ref: "#/definitions/HeaderSuccess"
        "400":
          description: Not found
          schema:
            properties:
              body:
                type: object
              header:
                $ref: "#/definitions/HeaderError"
  /volunteers:
    get:
      description: Gets an array of `Volunteer` object. Mandatory query param of **domain** determines the site / country the volunteers are from.
      parameters:
        - description: "the site the users are registered on, example: netherlands"
          in: query
          name: domain
          required: true
          type: string
        - description: the number of desired records. Default is 5.
          in: query
          name: limit
          required: false
          type: string
        - description: 1 or 0. filter on people that have the default avatar or not.
          in: query
          name: must_have_default_avatar
          type: boolean
      responses:
        "200":
          description: Successful response
          schema:
            properties:
              body:
                items:
                  $ref: "#/definitions/Volunteer"
                type: array
              header:
                $ref: "#/definitions/HeaderSuccess"
  "/volunteers/{UUID}":
    get:
      description: Get one specific `Volunteer` object by specifying its UUID in the url path.
      parameters:
        - in: path
          name: UUID
          required: true
          type: string
      responses:
        "200":
          description: Successful response
          schema:
            properties:
              body:
                $ref: "#/definitions/Volunteer"
              header:
                $ref: "#/definitions/HeaderSuccess"
        "400":
          description: Not found
          schema:
            properties:
              body:
                type: object
              header:
                $ref: "#/definitions/HeaderError"
definitions:
  Coordinates:
    properties:
      latitude:
        description: "Signed decimal format, example: 52.1234"
        type: string
      longitude:
        description: Signed decimal format, example -77.022223
        type: string
    type: object
  DateTime:
    description: "The date in YYYY-MM-DD HH:MM:SS format, example: 2015-12-31 23:59:59"
    type: string
  Event:
    properties:
      created:
        $ref: "#/definitions/DateTime"
      description:
        $ref: "#/definitions/HTML"
      end_date:
        $ref: "#/definitions/DateTime"
      groups:
        items:
          $ref: "#/definitions/GroupLite"
        type: array
      location:
        $ref: "#/definitions/Location"
      modified:
        $ref: "#/definitions/DateTime"
      name:
        type: string
      organizers:
        items:
          $ref: "#/definitions/VolunteerLite"
        type: array
      picture:
        $ref: "#/definitions/URL"
      serial:
        $ref: "#/definitions/Serial"
      start_date:
        $ref: "#/definitions/DateTime"
      uuid:
        $ref: "#/definitions/UUID"
    type: object
  Group:
    properties:
      created:
        $ref: "#/definitions/DateTime"
      description:
        $ref: "#/definitions/HTML"
      group_type:
        $ref: "#/definitions/GroupType"
      location:
        $ref: "#/definitions/Location"
      mission:
        type: string
      modified:
        $ref: "#/definitions/DateTime"
      name:
        type: string
      picture:
        $ref: "#/definitions/URL"
      serial:
        $ref: "#/definitions/Serial"
      uuid:
        $ref: "#/definitions/UUID"
    type: object
  GroupLite:
    properties:
      name:
        type: string
      serial:
        $ref: "#/definitions/Serial"
      uuid:
        $ref: "#/definitions/UUID"
    type: object
  GroupType:
    enum:
      - Country group
      - Campaign Project group
      - Local group
      - Discussion group
      - Interest group
      - Skills-based group
    type: string
  HTML:
    description: A string containing sanitized HTML code
    type: string
  HTTP_Code:
    description: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
    type: string
  HTTP_Status:
    description: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
    type: integer
  HeaderError:
    properties:
      code:
        $ref: "#/definitions/HTTP_Code"
      error:
        description: the error message
        type: string
      id:
        description: transaction nonce
        type: integer
      pagination:
        type: object
      resources:
        $ref: "#/definitions/ResourceType"
      status:
        $ref: "#/definitions/HTTP_Status"
    type: object
  HeaderSuccess:
    properties:
      code:
        $ref: "#/definitions/HTTP_Code"
      error:
        type: "null"
      id:
        description: transaction nonce
        type: integer
      pagination:
        $ref: "#/definitions/Pagination"
      resources:
        $ref: "#/definitions/ResourceType"
      status:
        $ref: "#/definitions/HTTP_Status"
    type: object
  ISO_3166-1_alpha-2:
    description: Country code see. https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
    type: string
  Location:
    properties:
      city:
        type: string
      coordinates:
        $ref: "#/definitions/Coordinates"
      country:
        type: string
      postcode:
        type: string
      state:
        type: string
      streetname:
        type: string
    type: object
  LocationSimple:
    properties:
      country:
        $ref: "#/definitions/ISO_3166-1_alpha-2"
    type: object
  Pagination:
    properties:
      limit:
        description: the nubmer of items per page
        type: integer
      page:
        description: the current page
        type: integer
      total:
        description: the total number of pages
        type: integer
    type: object
  ResourceType:
    description: The name of the requested object/model/resource. Plural if a collection.
    enum:
      - group
      - groups
      - event
      - events
      - volunteer
      - volunteers
    type: string
  Serial:
    description: The primary key in Drupal, e.g the entity/node id
    type: string
  URL:
    description: "A resource location, example: https://greenwire.greenpeace.org"
    type: string
  UUID:
    description: "Universally unique identifier in canonical format, example: de305d54-75b4-431b-adb2-eb6b9e546014"
    type: string
  Volunteer:
    properties:
      avatar:
        $ref: "#/definitions/URL"
      locations:
        items:
          $ref: "#/definitions/LocationSimple"
        type: array
      uuid:
        $ref: "#/definitions/UUID"
    type: object
  VolunteerLite:
    properties:
      serial:
        $ref: "#/definitions/Serial"
      uuid:
        $ref: "#/definitions/UUID"
    type: object
