Create a listing using the API

I want to integrate a Hivepress website with a 3rd party something

But from searching the forum, I found out that this is impossible because the API isn’t 100% covered yet

But, WordPress has a good API and form working with Hivepress I know that at the end of the day, this is just a post type “hp_listing” that handles all the listings

The category for listings is a custom field? or it’s the same as all other post types?

About API

“In addition to the default listing fields, you can also update custom fields added via the listing attributes or HivePress extensions.”

So, if I have a field that is called “hello_world” and it’s a text = string field I simply need to make the request like this

Request example

{
  "title": "string",
  "description": "string"
  "hello_world": "string"
}

Hi,

Sorry, there are currently no endpoints for listing creation, but we are planning to add this feature. As a workaround, we recommend using the default WP REST API, which is possible because a listing is a custom post type.

The custom post type name is hp_listing
also, the endpoint needs to be activated using this snipit

add_filter( 'register_post_type_args', 'add_rest_api_to_listing_post_type', 10, 2 );
function add_rest_api_to_listing_post_type( $args, $post_type ) {
	// Let's make sure that we're customizing the post type we really need
	if ( $post_type !== 'hp_listing' ) {
		return $args;
	}
	
	$args['show_in_rest'] = true;
	
	return $args;
}

Yes, but how can I fill out custom attributes? in the listing?
From reading the API-limited documentation

In addition to the default listing fields, you can also update custom fields added via the listing attributes or HivePress extensions.

{
  "title": "string",
  "description": "string"
  "hello_world": "integer"
  "date": "format_date(iso_date)"
}

Also, how do you use the categories? Are they added using the regular WordPress API?

Thanks for the help in advance! :slight_smile: