According to http://v2.wp-api.org/reference/posts/ you have categories_exclude available as a param to pass to the API.
This should work:
http://localhost/wp-json/wp/v2/events/?categories=23&categories_exclude=42&per_page=1
…to get the posts from category 23, but exclude those that also have 42 assigned as category.
Related Posts:
- Exclude Category filter from Portfolio section
- Include posts from some categories while excluding from others
- Exclude post ID from wp_query
- Exclude or Include category ids in WP_Query
- How to query only for products with status “in stock” in WooCommerce? [closed]
- WP_Query to show post from a category OR custom field
- get_posts with multiple categories
- ajax category filter
- Display recent posts from the same category as current post in sidebar
- WP Rest API v2 return posts with specific tag
- Counting number of posts with Category B in Category A
- How to order category.php loop by ‘meta_value’?
- Use Transient API to cache queries for all posts in all categories?
- How can I display recent posts from a particular category in my header?
- Sorting Posts by custom field
- Get attached media only
- WP Query with multiple categories – passing an array works?
- wp_query display posts from same category of the post
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- WP_query category__in not working, only pulls from first category
- WP_Query order by date in meta_value
- How get posts from a subcategory of a category by name?
- get complex results set according to category structure
- Order WP Query posts by custom order calculated from post meta values
- Searching through different categories on different pages code is not working
- Query Ignoring ‘exclude’ Parameter?
- Get image of latest post from taxonomies/categories
- How To Remove/hide some specific categories from two different categories widget from sidebar
- WP Rest API max limit include parameter?
- How to select posts from one category but exclude posts in another category?
- Get Category Archive Template Name Dynamically
- WP_Query arguments to fetch custom post type posts which are in certain category?
- How do I reset this wp_list_categories query?
- How can you get first post, last post and post count in a category?
- How to get count of posts assigned to given category?
- WP_Query Excluding pages with Order is 0
- Query: offset post list, unless it’s a specific category
- How to show subcategories using loop?
- WP_Query To call data from diffrent tables
- List of the years with posts presented
- Remove a specific category ID from related post
- Complex Category selection as per user input
- Show all post for a given category
- Five posts from a category in footer
- Return only post(s) which have post_excerpt
- Querying A Post That Includes Two Taxonomies Using JSON Rest API
- How to get all unique categories for posts in loop?
- How can I create ‘future’ and ‘past’ parameter for restAPI by filtering the CPT custom date field by greater than / less than current datetime?
- Display Featured Post by Categories and Avoid duplicated posts
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- category query for pages not working
- Can we return all category (not post) with Custom Query Filter? [closed]
- How does one perform a sub query with different post types
- Query posts intersecting tags and categories
- Query posts from category A, and from either category B or C
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- Loop Performance > JSON files vs. WP_Query vs. REST API
- REST API: Limit Read Permissions for Default Endpoints
- Excluding pages in WP_query using ACF
- Combining categories (Query posts with multiple taxonomy terms)
- Check if loop has any categories?
- Filtering out child category posts from parent category archive not working
- Avoid repeated post on page 2 when excluding one on page 1
- Inserting HTML to close and open divs in WP_Query loops
- Limiting number of related posts
- Category ‘pad_counts’ & ‘parent’ conflict
- 2 wordpress loops showing 1 post from same post type – how to avoid showing the same post?
- Finding WordPress Posts assigned to multiple categories
- Exclude current post from an array of posts?
- Combine results of multiple WP_Query to resemble single WP_Query
- Loop doesn’t exclude the specified category in home page
- Exclude recently updated post from custom WP_Query using multiple loops
- WordPress Custom Search Form Displaying Unexpected Results
- How to exclude Sticky from Recent Post?
- Get user first name from custom endpoint
- JSON – Create rest api endpoint for Advanced Custom Fields
- Query_vars support in Rest API
- wp_query is showing posts from other categories
- WP_Query Taxonomy categories filtering
- Hide products in uncategorized category from search results
- How to load a script code only in posts?
- How to echo woocommerce category name
- How to display a list of posts in same child category as current post
- Slider won’t work with custom query
- WP_Query with one category in args shows other categories
- How to exclude a category name from showing?
- Loop categories by recent post
- How order posts from category by date and comment count?
- Get the child category ID of current category
- How to get posts by category and by choosing a taxonomy term?
- Related Posts Excluding Certain Categories
- Getting the permalink to the latest post from a category
- What is wrong with my WP_Query Arguments?
- I need to exclude from a query a category and a few custom taxonomies
- specific post is not excluded from the loop
- Widgets: Show Recent Posts Only if the Posts Have Both Categories X and Y
- get_the_terms has strange result since version 6.0
- How can I return only IDs from the `posts` REST endpoint?
- Post incorrectly excluded when using “category__in”?