Skip to content

REST API

Thomas Elvin edited this page Jul 28, 2018 · 27 revisions

CRUD

When you have setup your API key, you need to know the different fields required to CRUD data to and from GO.

The listed fields af both WP-required and required by GO itself. Unless they are "required", all fields ar optional.

Create (POST wp-json/wp/v2/go)

  • status (text string): A named status for the object. One of: "publish", "future", "draft", "pending", "private" (Default is "publish")
  • title (text string): The title for the object (required).
  • content (textarea string): The content for the object (required).
  • author (integer number): The ID for the author of the object (if no ID i given, auth is used instead).
  • excerpt (textare string): The excerpt for the object.
  • featured_media (integer number): The ID of the featured media for the object.
  • comment_status (text string): Whether or not comments are open on the object. One of: "open", "closed"
  • go-categories (array integer number): The term ID's array assigned to the object in the category taxonomy, see taxonomies. (required)
  • go-tags (array integer number): The term ID's array assigned to the object in the tag taxonomy, see taxonomies.
  • go-locations (array integer number): The term ID's array assigned to the object in the location taxonomy, see taxonomies.

Meta fields:

  • _listings_level (integer number): ID of GO section, see taxonomies.
  • _contact_email (text string): Default contact email (optional)
  • _location_id (integer number): The term ID assigned to the object in the location taxonomy, see taxonomies.
  • _address_line_1 (text string): Contact address 1
  • _address_line_2 (text string): Contact address 2
  • _zip_or_postal_index (text string): Contact zipcode
  • _content_field_10 (text string): Contact name
  • _content_field_8 (email): Contact email
  • _content_field_6 (text string): Contact telephone
  • _content_field_11 (text string): Contact mobil telephone
  • _content_field_9 (text string): Contact fax
  • _content_field_7 (website url): Contact website (serialized data: 'url' => 'http://example.org', 'text' => 'My website')
  • _content_field_35 (website url): Other contact website (serialized data: 'url' => 'http://example.org', 'text' => 'My website')

Event meta:

  • _content_field_13 (Date-Time): Start date
  • _content_field_24 (Date-Time): End date
  • _content_field_33 (text string): Time
  • _content_field_22 (textarea string): Organizers
  • _content_field_36 (text string): Pricce

Publication meta:

  • _content_field_14 (text string): ISBN/ISSN nr.
  • _content_field_16 (text string): Author of publication
  • _content_field_15 (text string): Language
  • _content_field_17 (text string): Publisher
  • _content_field_18 (text string): Publish year

Social meta

  • _content_field_25 (array website url): Contact Facebook (serialized data: 'url' => 'http://example.org', 'text' => 'My Facebook')
  • _content_field_28 (array website url): Contact Google+ (serialized data: 'url' => 'http://example.org', 'text' => 'My Google+')
  • _content_field_26 (array website url): Contact Twitter (serialized data: 'url' => 'http://example.org', 'text' => 'My Twitter')
  • _content_field_27 (array website url): Contact LinkedIn (serialized data: 'url' => 'http://example.org', 'text' => 'My LinkedIn')
  • _content_field_29 (array website url): Contact Instagram (serialized data: 'url' => 'http://example.org', 'text' => 'My Instagram')
  • _content_field_30 (array website url): Contact Skype (serialized data: 'url' => 'http://example.org', 'text' => 'My Skype')
  • _content_field_31 (array website url): Contact YouTube (serialized data: 'url' => 'http://example.org', 'text' => 'My YouTube')
  • _content_field_32 (array website url): Contact Vimeo (serialized data: 'url' => 'http://example.org', 'text' => 'My Vimeo')
  • _content_field_34 (array website url): Contact custom video link (serialized data: 'url' => 'http://example.org', 'text' => 'My Video')

Media meta:

  • _attached_image (integer number): ID of image uploaded to GO (optional)
  • _attached_image_as_logo (integer number): ID of image uploaded to GO as logo (optional)
  • _thumbnail_id (integer number): ID of image uploaded to GO as logo (optional)

Read (GET wp-json/wp/v2/go/id)

  • id: Unique identifier for the object.

Update (POST wp-json/wp/v2/go/id)

  • id: Unique identifier for the object.

... and same fields from "Create"

Delete (DELETE wp-json/wp/v2/go/id)

  • id: Unique identifier for the object.
  • force: Whether to bypass trash and force deletion (passed as "?force=true").

Taxonomies (categories, tags etc.)

Use the following taxonomies when creating new content on GO. The ID is required to link content to a taxonomy.

NB: To show more results, use the parameter "?per_page=1" etc.

Sections (also called levels, 1-6)

  • 1: The Green Pages (DGS)
  • 2: The Green Library (DGB)
  • 3: Eco-calender (OK)
  • 4: The Green Archive (DGA)
  • 6: The Green Bulletin board (DGO)

Categories (GET wp-json/wp/v2/go-categories)

https://grontoverblik.dk/wp-json/wp/v2/go-categories

Main categories ID's:

  • 454: The Green Pages
  • 455: The Green Library
  • 456: Eco-calender
  • 610: The Green Bulletin board

Tags (GET wp-json/wp/v2/go-tags)

https://grontoverblik.dk/wp-json/wp/v2/go-tags

Locations (GET wp-json/wp/v2/go-locations)

https://grontoverblik.dk/wp-json/wp/v2/go-locations

Main location ID's:

  • 234: The capital (Hovedstaden)
  • 268: Zealand (Sjælland)
  • 266: Midtjylland
  • 267: Nordjylland
  • 265: South Denmark (Syddanmark)
Clone this wiki locally
You can’t perform that action at this time.