Title: SEOPress GetPost API
Last modified: May 8, 2023

---

# SEOPress GetPost API

 *  Resolved [apopov](https://wordpress.org/support/users/apopov/)
 * (@apopov)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/getpost-api/)
 * Hello, I have a need to retrieve redirections metadata from SEOPress plugin by
   REST API. I can successfully get it with **wp-json/seopress/v1/posts/:id** endpoint,
   passing redirection post id as path parameter. But when I try to use **/wp-json/
   seopress/v1/posts/by-url?url=[URL]** endpoint, passing there URL with redirection
   slug, I receive 500 error in response. (e.g. [https://example.com/wp-json/seopress/v1/posts/by-url?url=https://example.com/live-demo-apple-watch](https://example.com/wp-json/seopress/v1/posts/by-url?url=https://example.com/live-demo-apple-watch))
 * I did some debugging, and this is happening due to plugin being unable to specify
   post-id by url at:
   …/wp-content/plugins/wp-seopress/src/Actions/Api/GetPost.php:
   110
 * in processGetByUrl function, at this line i receive 0 as $id:
 *     ```wp-block-code
       $id = apply_filters('seopress_headless_url_to_postid', url_to_postid($url), $request);
       ```
   
 * Then for some reason, returned error results in 500 error (but that’s another
   question):
 *     ```wp-block-code
       if(!$id){
           return new \WP_Error("not_found", "ID for URL not found");
       }
       ```
   
 * Can you please help me with that?
 * WordPress Version: 6.2
 * SEOPress Version 6.5.0.3
 * SEOPress PRO Version 6.5
 * PHP version 8.2.5 (Supports 64bit values)
    -  This topic was modified 3 years, 1 month ago by [apopov](https://wordpress.org/support/users/apopov/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/getpost-api/#post-16719580)
 * Hi,
 * I guess you already know this guide to get started with our REST API?
 * [https://www.seopress.org/support/guides/get-started-with-the-seopress-rest-api/](https://www.seopress.org/support/guides/get-started-with-the-seopress-rest-api/)
 * Can you update Free and PRO to version 6.6.3 and 6.6.1?
 * As you’re a PRO customer, we invite you to open a support ticket from your customer
   area to help you:
 * [https://www.seopress.org/account/your-tickets/](https://www.seopress.org/account/your-tickets/)
 * Thank you!
 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [3 years ago](https://wordpress.org/support/topic/getpost-api/#post-16796821)
 * We are closing this ticket due to inactivity. Thank you for understanding.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SEOPress GetPost API’ is closed to new replies.

 * ![](https://ps.w.org/wp-seopress/assets/icon-128x128.gif?rev=3158903)
 * [SEOPress - AI SEO Plugin & On-site SEO](https://wordpress.org/plugins/wp-seopress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-seopress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-seopress/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-seopress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-seopress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-seopress/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/getpost-api/#post-16796821)
 * Status: resolved