# Documentation of MeOS REST API

## Competition

Syntax:

    /meos?get=competition

Returns:

MOP Competition XML

Example:

    *MOPComplete>
     *competition date="2015-09-06" organizer="Orienteringsklubben Linné" homepage="http://www.oklinne.nu">Stafett-DM, Uppland*/competition>
    */MOPComplete>

## Classes

Syntax:

    /meos?get=class

Returns:

MOP Classes XML

Example:

    *MOPComplete>
     *cls id="1" ord="10" radio="90,130;90,130;90,130">D21*/cls>
     *cls id="100" ord="1000" radio="90,130">M7*/cls>
    */MOPComplete>

Remarks: The attribute ord should be used to sort classes. The attribute radio lists the MeOS default radio control for each class and leg. Each leg of the class is separated by ';' and each radio control within a leg with ','. Note that you may query for results at any control; the listed controls are only for convenience.

## Controls

Syntax:

    /meos?get=control

Returns:

MOP Controls XML

Example:

    *MOPComplete>
      *control id="31">[31]*/control>
      *control id="32">[32]*/control>
      *control id="50">Radio 1*/control>
    */MOPComplete>

## Competitors

Syntax:

    /meos?get=competitor

    /meos?get=competitor#class=*c1>,*c2>,...

Arguments:

- class A list of one or more class id:s, separated by comma. The default is all classes.

Returns:

MOP Competitors XML

Example:

    *MOPComplete>
      *cmp id="3565">
        *base org="570" cls="5" stat="1" st="360000" rt="20580">Elsa Winter*/base>
        *input it="20340" tstat="1"/>
      */cmp>
      *cmp id="55851">
        *base org="134" cls="7" stat="1" st="380710" rt="46910">Anna Spring*/base>
      */cmp>
    */MOPComplete>

Remarks: Please refer to the MOP documentation for a complete description of all attributes. Below is a quick reference.

- stat Status code. 1 is OK, 0 is unknown. Higher codes are used for disqualifications.
- st Start time. In 1/10 seconds after 00:00:00.
- rt Running time. In 1/10 seconds.
- input/it Input running time accumulated from earlier races. In 1/10 seconds.
- input/st Input status from earlier races.

## Teams

Syntax:

    /meos?get=team

    /meos?get=team#class=*c1>,*c2>,...

Arguments:

- class A list of one or more class id:s, separated by comma. The default is all classes.

Returns:

MOP Teams XML

Example:

    *MOPComplete>
      *tm id="2928771">
        *base org="396" cls="5" stat="1" st="360000" rt="65770">IF Thor 1*/base>
        *r>34346;48866,866,0;32609*/r>
      */tm>
      *tm id="2928346">
        *base org="134" cls="5" stat="1" st="360000" rt="99660">OK Enen 1*/base>
        *r>42020;55851;35732*/r>
      */tm>
    */MOPComplete>

Remarks: Please refer to the MOP documentation for a complete description of all attributes. Below is a quick reference.

- stat Status code. 1 is OK, 0 is unknown. Higher codes are used for disqualifications.
- st Start time. In 1/10 seconds after 00:00:00.
- rt Running time (At finish, last leg). In 1/10 seconds.
- r List of runners in the team. A ';' is used to separate the legs, a ',' within a legs are used to list paralell runners. A '0' indicates a vacant leg, which may or may not be valid for the team, depending on the rules.

## Organizations and Clubs

Syntax:

    /meos?get=organization

Returns:

MOP Organization XML

Example:

    *MOPComplete>
      *org id="1012">BAOC*/org>
      *org id="598">Dalaportens OL*/org>
      *org id="133">Enebybergs IF*/org>
      *org id="140">Falkenbergs OK*/org>
    */MOPComplete>

## Results

Syntax:

    /meos?get=result

    /meos?get=result#class=*c1>,*c2>,...

    /meos?get=result#to=*c1>

    /meos?get=result#from=*c1>

    /meos?get=result#leg=*leg>

    /meos?get=result#module=*module>

    /meos?get=result#module=*module>#argument=*arg>

    /meos?get=result#limit=*limit>

    /meos?get=result#total=*true/false>

    /meos?get=result#type=*type>

Arguments:

- class A list of one or more class id:s, separated by comma. The default is all classes.
- from Returns the result measuring time from a specific control. If a specified class does not visit the control, an empty result set is returned; no error is given. The default is the start.
- to Returns the result at a specific control. If a specified class does not visit the control, an empty result set is returned; no error is given. The default is the finish.
- leg In a team competition, returns result for a specified leg. If the leg is parallel, the result is for the completed parallel leg. The leg number refer to the flat view in MeOS class settings, i.e., for a setup "1, 2a, 2b, 2c, 3", correspons to flat leg numbers, "1, 2, 3, 4, 5". The default is the last leg.
- module The result module tag to use for the result calculation. The support of the leg and control options depends on result module. The default is no module.
- argument A numeric argument, defined and used by the result module.
- limit Limit the number of results per class. If there is a tie, the number of returned results may be higher than the requested. The default is no limit.
- total Set to true if you want to calculate total results, i.e., results including earliers stages.
- type Use one of ClassIndividual (default for individual classes), CourseIndividual, GlobalIndividual, or LegIndividual to calculate individual results. CourseIndividual calculates result per course, ignoring class. GlobalIndividual calculates results without considering classes, LegIndividual calculates results considering classes and legs. Use one of ClassTeam (default for team classes) or GlobalTeam to calculate team results. GlobalTeam calculates team results without considering classes.

Returns:

MOP Individual or Team Result XML. The result list is sorted according to the result. Note than disqualified competitors are also included; for example a competitor with status *DNS> will be returned with this status for all radio controls. You may want to filter out such entries, depending on your application.

Examples:

Individual results at the finish.

    *MOPComplete>
      *results location="Finish">
        *person cls="100" stat="1" st="387240" rt="21880" place="1">
          *name id="134940">Isac Ulvesson*/name>
          *org id="2184">BOIC*/org>
        */person>

        *person cls="100" stat="1" st="387700" rt="22720" place="2">
          *name id="134923">Anne Brahe*/name>
          *org id="2253">IFA*/org>
        */person>

        *person cls="100" stat="1" st="382570" rt="23260" place="3">
          *name id="134914">Dan Andersson*/name>
          *org id="5938">OK Kompassen*/org>
        */person>
      */results>
    */MOPComplete>

Team results, leg 2 at Radio 1, leg has three parallel runners.

    *MOPComplete>
      *results leg="2" location="Radio 1">
        *team cls="6" stat="1" st="372000" rt="32030" place="1">
          *name id="2927509">OK Linné 1*/name>
          *org id="84">OK Linné*/org>
          *person cls="6" leg="2" stat="1" st="392720" rt="11310">
            *name id="52054">John Woods*/name>
            *org id="84">OK Linné*/club>
          */person>

          *person cls="6" leg="3" stat="3" st="392720">
            *name id="134850">Ralph Audoro*/name>
            *org id="84">OK Linné*/org>
          */person>

          *person cls="6" leg="4" stat="1" st="392720" rt="12850">
            *name id="134851">Niel Success*/name>
            *club id="84">OK Linné*/club>
          */person>
      */team>
      */results>
    */MOPComplete>

Roganing results, Invoke with argument module=rogaining, which is a built in module.

    *MOPComplete>
      *results module="rogaining" location="Finish">
        *person cls="1" stat="1" score="26" st="324000" rt="72550" place="1">
          *name id="4">Omar Rue*/name>
        */person>

        *person cls="1" stat="1" score="25" st="324000" rt="72730" place="2">
          *name id="3">Oscar Wilde*/name>
        */person>

        *person cls="1" stat="1" score="25" st="324000" rt="72780" place="3">
          *name id="5">Alice Alison*/name>
        */person>

        *person cls="1" stat="5" score="26" st="324000" rt="72590">
          *name id="6">Reimund Rossinger*/name>
        */person>
      */results>
    */MOPComplete>

Remarks: When and only when the type is CourseIndividual, the attribute course/i> is included.

    *person cls="1" stat="1" st="324000" rt="72550" place="1" course=28>
      *name id="4">Jordan Griesmer*/name>
    */person>

## IOF XML Results

Syntax:

    /meos?get=iofresult

    /meos?get=iofresult#class=*c1>,*c2>,...

Arguments:

- class A list of one or more class id:s, separated by comma. The default is all classes.

Returns:

IOF XML version 3.0 result list.

## IOF XML Startlist

Syntax:

    /meos?get=iofstart

    /meos?get=iofstart#class=*c1>,*c2>,...

Arguments:

- class A list of one or more class id:s, separated by comma. The default is all classes.

Returns:

IOF XML version 3.0 start list.