ver. 2035 (2605b6c)
services/apiref
services/apisrv
services/attrs
services/caches
services/caches/formatters
services/caches/map
services/caches/search
services/caches/shortcuts
services/draftlogs
services/lists
services/logs
services/logs/images
services/oauth
services/replicate
services/users

Upload Fieldnotes OCDE
:: services/draftlogs/upload_fieldnotes method

Minimum Authentication: Level 3 (see Authentication Levels)
https://www.opencaching.us/okapi/services/draftlogs/upload_fieldnotes

This method allows you to upload a series of fieldnote objects in CSV format. Fieldnotes are draft versions of log entries. Once uploaded, users will be able to review, edit, and submit them via the Opencaching website.

This method is only available on installations that support draft logs. Check the has_draft_logs field in services/apisrv/installation before calling it.

field_notes required

The fieldnotes data. Accepted either as a raw string or base64-encoded (base64 is recommended when the log text contains newlines or special characters, and is required when using the OKAPI Browser).

The data is a sequence of CSV records with no header line. Each record has four fields:

  1. Geocache Code - e.g. OC1012
  2. Date - ISO 8601 UTC, e.g. 2023-11-23T10:17:55Z
  3. Log Type - matched case-insensitively. Both the names used by geocaching.com field note files (as written by Garmin devices, cgeo and other apps) and the OKAPI log type names are accepted. They are mapped to the draft log types of the website:
    • Found it, Attended - found (on events, the website turns it into an Attended log),
    • Didn't find it - didn't find it,
    • Write note, Comment, Owner Maintenance - comment,
    • Needs Maintenance - comment with "needs maintenance" set.
    Records with other log types are silently skipped.
  4. Log Text - may span multiple lines and contain quote characters. It is stored as HTML (line breaks become <br />), as the website's own field notes upload does, and shortened to 255 characters.

Character encoding is detected automatically. Supported encodings: UTF-8 (with or without BOM), UTF-16LE (with or without BOM), UTF-16BE (with BOM). This covers all known fieldnote sources (cgeo, Garmin, Looking4Cache, etc.).

Fieldnotes produced by multi-platform apps (e.g. cgeo) typically contain records for several geocaching platforms at once. Records not starting with an OC cache code are silently skipped; the difference between total_records and processed_records in the response reflects this.

format optional Standard common formatting argument.
callback optional Standard common formatting argument.
Plus required standard OAuth Consumer signing arguments: oauth_consumer_key, oauth_nonce, oauth_timestamp, oauth_signature, oauth_signature_method, oauth_version. Plus required oauth_token for Token authorization.

Returned value:

A dictionary of the following structure:

  • success - true
  • total_records - number of CSV records found in the input
  • processed_records - number of records actually inserted as draft logs; may be less than total_records when records are skipped (wrong platform prefix, unsupported log type, unknown cache code, invalid date)
  • draft_ids - list of the IDs of the inserted draft logs, in input order; see services/draftlogs/query and services/draftlogs/delete