PressForward / pressforward

PressForward is a free plugin that provides an editorial workflow for content aggregation and curation within the WordPress dashboard. It is designed for bloggers and editorial teams who wish to collect, discuss, and share content from a variety of sources on the open web.
GNU Affero General Public License v3.0
120 stars 21 forks source link

Add PF data to WP-API post endpoint #807

Closed AramZS closed 8 years ago

AramZS commented 8 years ago

Post should have:

AramZS commented 8 years ago

Featured image is on _links[wp:featuredmedia]

AramZS commented 8 years ago

Item content is content

AramZS commented 8 years ago

Item retrieved is on item_wp_date

AramZS commented 8 years ago

Item tags is on tags

AramZS commented 8 years ago

I've added Wordcount to the API, but I don't know if it is something we should even store (or that it is working). @regan008 @stakats - Is there any conceivable case in which we would be sorting database results by wordcount? If not, we should eliminate it and do a word count after the post has been retrieved, dropping it as something we store in the DB.

regan008 commented 8 years ago

Adding @casmir72 to this issue as he will be helping me test this week.

regan008 commented 8 years ago

@AramZS I'm am noticing that the date nominated field is not formatted the same as all the other date fields. So for example I see:

"item_wp_date": "Sun, 28 Aug 2016 12:34:18 +0000",
    "date_nominated": "2016-08-29T17:39:50+00:00",

Here is the original post: https://smittenkitchen.com/2016/08/even-more-perfect-blueberry-muffins/

And here is the full response:

{
    "id": 7720,
    "date": "2016-08-29T17:39:50",
    "date_gmt": "2016-08-29T17:39:50",
    "guid": {
        "rendered": "http:\/\/feedproxy.google.com\/~r\/smittenkitchen\/~3\/BZv547SG5-A\/"
    },
    "modified": "2016-08-29T17:40:00",
    "modified_gmt": "2016-08-29T17:40:00",
    "slug": "even-more-perfect-blueberry-muffins",
    "type": "post",
    "link": "http:\/\/local.wordpress.dev\/2016\/08\/29\/even-more-perfect-blueberry-muffins\/",
    "title": {
        "rendered": "even more perfect blueberry muffins"
    },
    "content": {
        "rendered": "<p><a href=\"https:\/\/smittenkitchen.com\/2016\/08\/even-more-perfect-blueberry-muffins\" title=\"even more perfect blueberry muffins\"><img src=\"https:\/\/c4.staticflickr.com\/9\/8281\/29207441731_3e6163f1f2_z.jpg\" width=\"640\" height=\"426\" alt=\"even more perfect blueberry muffins\"><\/a><\/p>\n<p><a href=\"https:\/\/smittenkitchen.com\/2010\/08\/perfect-blueberry-muffins\/\">[Get the recipe for <strong>Even More Perfect Blueberry Muffins<\/strong> right here]<\/a><\/p>\n<p>Since we rolled out the <a href=\"https:\/\/smittenkitchen.com\/2016\/07\/welcome-to-the-shiny-new-smitten-kitchen-2-0\/\">redesign<\/a>, I&#8217;ve been flagging recipes in the archives I can&#8217;t stand looking at the pictures of anymore with plans to reshoot them. The <a href=\"https:\/\/smittenkitchen.com\/2010\/08\/perfect-blueberry-muffins\/\">perfect blueberry muffins<\/a> were on this list except on my way to prettying them up, I made four other recipes first. Why make four other batches of blueberry muffins when you already have a favorite, is a pretty reasonable question, only if you&#8217;ve never shopped for jeans before even while wearing the pair you like most&#8230; or ordered steak at a restaurant besides the place you think makes it best. What I mean is, when a lot of people say &#8220;but the steak\/jeans\/cake here are amazing!&#8221; it&#8217;s hard not to wonder if maybe they&#8217;re onto something. What if they were just my favorite blueberry muffins <i>at the time<\/i> and there&#8217;s better out there that I didn&#8217;t know about yet? <a href=\"https:\/\/smittenkitchen.com\/2010\/08\/perfect-blueberry-muffins\/\">It&#8217;s been eight years. <\/a>Maybe it was time for a re-review. [Note: The prospect of a re-review with outside sources every few years is not recommended to be applied to spouses, children or hairdressers.] <\/p>\n<p>more<img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=smittenkitchen.com&#038;blog=106528731&#038;post=29099&#038;subd=smittenkitchendotcom&#038;ref=&#038;feed=1\" width=\"1\" height=\"1\" \/><\/img>\n<p>Source: <a href=\"http:\/\/feedproxy.google.com\/~r\/smittenkitchen\/~3\/BZv547SG5-A\/\" target=\"_blank\" pf-nom-item-id=\"7656\">even more perfect blueberry muffins<\/a><\/p>\n"
    },
    "excerpt": {
        "rendered": "<p>[Get the recipe for Even More Perfect Blueberry Muffins right here] Since we rolled out the redesign, I&#8217;ve been flagging recipes in the archives I can&#8217;t stand looking at the pictures of anymore with plans to reshoot them. The perfect blueberry muffins were on this list except on my way to prettying them up, I<a class=\"excerpt-read-more\" href=\"http:\/\/local.wordpress.dev\/2016\/08\/29\/even-more-perfect-blueberry-muffins\/\" title=\"Readeven more perfect blueberry muffins\">&#8230; Read more &raquo;<\/a><\/p>\n"
    },
    "author": 1,
    "featured_media": 0,
    "comment_status": "closed",
    "ping_status": "closed",
    "sticky": false,
    "format": "standard",
    "categories": [1],
    "tags": [],
    "item_id": "ab6b6b16beeb382d42eb65c67e2d8331",
    "source_title": "smitten kitchen",
    "pf_source_link": "http:\/\/smittenkitchen.com",
    "item_date": "Sun, 28 Aug 2016 12:34:18 +0000",
    "item_author": "deb",
    "item_link": "http:\/\/feedproxy.google.com\/~r\/smittenkitchen\/~3\/BZv547SG5-A\/",
    "item_wp_date": "Sun, 28 Aug 2016 12:34:18 +0000",
    "date_nominated": "2016-08-29T17:39:50+00:00",
    "source_repeat": "false",
    "nomination_count": "1",
    "submitted_by": 1,
    "nominator_array": [1],
    "readable_status": 1,
    "pf_feed_item_word_count": 192,
    "pf_forward_to_origin": "no-forward",
    "_links": {
        "self": [{
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/posts\/7720"
        }],
        "collection": [{
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/posts"
        }],
        "about": [{
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/types\/post"
        }],
        "author": [{
            "embeddable": true,
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/users\/1"
        }],
        "replies": [{
            "embeddable": true,
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/comments?post=7720"
        }],
        "version-history": [{
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/posts\/7720\/revisions"
        }],
        "feed": [{
            "embeddable": true,
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/pf\/v1\/feeds\/63"
        }],
        "wp:attachment": [{
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/media?parent=7720"
        }],
        "wp:term": [{
            "taxonomy": "category",
            "embeddable": true,
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/categories?post=7720"
        }, {
            "taxonomy": "post_tag",
            "embeddable": true,
            "href": "http:\/\/local.wordpress.dev\/wp-json\/wp\/v2\/tags?post=7720"
        }],
        "curies": [{
            "name": "wp",
            "href": "https:\/\/api.w.org\/{rel}",
            "templated": true
        }]
    }
}
regan008 commented 8 years ago

@AramZS Other than the format of dates in some place, I am not seeing any issues with the endpoints.

AramZS commented 8 years ago

Hmmm. Ok, with this in mind I'm going to close this issue and push the date fix to 4.2