°C/bar/m change

dive.io in Deutsch

Resource /dives/<id>

This resource represents a single dive log entry stored on the dive.io server. The dive log entry is identified by the "Id" attribute. Note that "DiveNumber" and "Id" are different things - "Id" is used to identify a dive record on the server, while "DiveNumber" is the (optional) number assigned to the dive in the logbook.

The Dive object returned may also include Buddy and profile information (Samples)

.
Resource URI
https://api.dive.io/v1/dives/<id> (.xml/.json)
Supported HTTP methods
GET (show), POST (update), DELETE, OPTIONS

GET /dives/<id> (show)

Description
Returns the data stored about a single dive log entry, identified by <id>.
Authentication
Required. Only dives by the authenticated user can be requested
Request structure
The GET URI parameter <id> (lowercase) identifies the dive record to be returned. Do use the "Id" attribute, and not the "DiveNumber" attribute for this parameter.
Response structure
A single Dive object (full format)

Example response (XML)

<?xml version="1.0" encoding="UTF-8"?>
<DiveIo>
  <Dive>
    <Id>30</Id>
    <DiverId>4</DiverId>
    <DiveDate>2010-09-18</DiveDate>
    <InTime>10:03:00</InTime>
    <Duration>00:39:50</Duration>
    <MaxDepth>30.7</MaxDepth>
    <AvgDepth>18.2445378151</AvgDepth>
    <Location>Okrug Gornji</Location>
    <Site>Zaparin</Site>
    <InPressure>202</InPressure>
    <OutPressure>47</OutPressure>
    <TankVolume>12</TankVolume>
    <PercentageO2>21</PercentageO2>
    <WaterType>s</WaterType>
    <Visibility>12</Visibility>
    <SurfaceTemp>19</SurfaceTemp>
    <BottomTemp>17</BottomTemp>
    <AirTemp>26</AirTemp>
    <DiveNumber>132</DiveNumber>
    <Notes>What a lovely dive!</Notes>
    <Created>2011-03-17 11:00:11.27922+01</Created>
    <Modified>2011-04-20 11:46:32.162026+02</Modified>
    <Buddies>
      <Buddy>
        <RelationId>20</RelationId>
        <Name>Jim</Name>
        <Type>buddy</Type>
        <Confirmed>no</Confirmed>
      </Buddy>
    </Buddies>
    <Samples>
      <Sample>
        <Elapsed>0</Elapsed>
        <Depth>0</Depth>
        <Pressure>0</Pressure>
      </Sample>
      <Sample>
        <Elapsed>20</Elapsed>
        <Depth>8</Depth>
        <Pressure>199</Pressure>
      </Sample>
      <!-- ... (more samples) -->
    </Samples>
  </Dive>
  <Status>200 OK</Status>
</DiveIo>

POST /dives/<id> (update)

Description
Replaces the dive record identified by the parameter "id" with the given information.
Authentication
Required
Request structure
  • The URI component <id> identifies the dive record to be updated.
  • The dive fields to be updated must be given in a JSON or XML formatted Dive object. (like in the example above)
  • If XML format is used, the data must be given in a POST parameter named "xml". If JSON is used, data is to be given in the "json" POST parameter.
  • Fields that are contained in the given data are changed (if possible), fields that are not given are not modified.
  • To remove a field from a Dive record, add an empty Tag / Hash element to the update, eg. for remove the "SurfaceTemp" field, use:
        <SurfaceTemp />
    
  • Note that not all fields of a Dive record are updateable - see list below
Response structure
Returns the updated full Dive object, as well as a list of updated and ignored attributes.

List of Updateable fields

The following fields can be updated - other fields given in the POST data will be ignored: