Methods

You can interact with the data in your account using the methods decribed on this page. With these methods you can add & update content. Available methods are:

You will interact with the Osmek API via POST information. Every method requires at minimum your account API key (api_key), and the section id (section_id) you wish to interact with. Each method may require additional parameters.

Response Formats

Each of the following methods will return a response in one of the formats described in the Response Formats section. At minimum a response will contain the values "status" and "msg." Status will be either "ok" or "fail" indicating whether or not the action was successful. If the action failed, "msg" will contain information about what happened.

Example JSON failure response.

{"status": "fail", "msg": "The comment could not be added. Invalid email address."}

Create

The create method allows you to create new items in a section. Simply post a list of field/value pairs for the fields you want to add, along with your api_key, and section_id.

Required Parameters

  • api_key - an api key on your account.
  • section_id - the section id containing the item you want to update.

Most sections support the following fields:

  • title
  • url_title - if not included, a url title will be generated based upon the title given.
  • description
  • active - '1' for true, or '0' for false. Defaults to '1'
  • tags - a comma seperated list of tags.
  • flag
  • date - a UNIX timestamp.
  • send_subscription - if you use subscriptions in your section, setting this to '1' will email your subscribers about your new item. Defaults to '0'

You may also send custom field variable names. Additional field names for specific sections will be documented soon, but in general they match the field names in Osmek (example: venue_url & address).


Update

The update method allows you to update existing content. Simply post a list of field/value pairs for the fields you want to update, along with your api_key, section_id, and the item_id of the item you want to update.

Required Parameters

  • api_key - an api key on your account.
  • section_id - the section id containing the item you want to update.
  • item_id - the ID of the item you want to update.

Additional update actions

  • addtags - adds tags to an item. Can be a comma seperated list of tags.
  • removetags - removes tags from an item. Can be a comma seperated list of tags.

Delete

A delete method is currently not available through the API. If you want to delete an item through the API, try updating the item, setting active to '0'. This will turn the item off, effectively hidding it form your site.

New_contact

This method adds a new contact to a Contacts section.

Required parameters

  • api_key - an api key on your account.
  • section_id - the section id containing the item you want to update.
  • email - the email address to add.

Optional Parameters

  • first_name
  • last_name
  • full_name
  • address
  • city
  • state
  • zip
  • tags - a comma seperated list of tags

Make_comment

This method allows you to add a comment on an item.

Required parameters

  • api_key - an api key on your account.
  • section_id - the section id containing the item you want to update.
  • item_id - the id of the item the comment should be added to.
  • email - the email address of the commentor.
  • comment - the comment text.

Optional Parameters

  • author - the authors name.
  • url - a url for the author.

Osmek will automatically check your comment against the Akismet spam checker if you include the following parameters with your request. These values will also be stored along with the comment and used to report to Akismet if you make a comment as spam or not spam later on.

  • user_ip - the IP address of person making the comment.
  • user_agent - the user agent of person making the comment.
  • user_referer - the address of the page which referred the user agent to the script making the comment.

Subscribe

This method will add an email address as a subscriber to a section.

Required parameters

  • api_key - an api key on your account.
  • section_id - the section id containing the item you want to update.
  • email - the email address of the commentor.

Check_login

This method validate a user's credentials.

Required parameters

  • api_key - an api key on your account.
  • username - the user's username.
  • password - the user's password + the account id, as an md5 hash.