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
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, with the current version you have to use the default WP REST API for the “hp_listing” post type. The listing submission form is basically the listing update form, because the listing auto-draft is already created if you click the Add Listing button.
Attributes are implemented depending on their type, e.g. text/number attributes are implemented as post meta fields with “hp_” prefix. Selectable attributes are implemented as custom taxonomies with “hp_listing_” prefix, the listing category is a custom taxonomy of “hp_listing_category” name.
This way you can still set all the values for attributes on WP level.