Make WordPress Core

Changeset 44150


Ignore:
Timestamp:
12/14/2018 02:34:28 AM (5 years ago)
Author:
jeremyfelt
Message:

REST API: Add endpoints for blocks.

WP_REST_Block_Renderer_Controller allows rendering of server-side rendered blocks, whilst WP_REST_Blocks_Controller allows retrieving of reusable blocks.

Merges [43805] and [43806] from the 5.0 branch to trunk.

Props desrosj, danielbachhuber, pento, Presskopp, swissspidy.
See #45065, #45098.

Location:
trunk
Files:
6 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/post.php

    r44146 r44150  
    256256        'wp_block',
    257257        array(
    258             'labels'          => array(
     258            'labels'                => array(
    259259                'name'          => __( 'Blocks' ),
    260260                'singular_name' => __( 'Block' ),
    261261                'search_items'  => __( 'Search Blocks' ),
    262262            ),
    263             'public'          => false,
    264             '_builtin'        => true, /* internal use only. don't use this when registering your own post type. */
    265             'show_ui'         => true,
    266             'show_in_menu'    => false,
    267             'rewrite'         => false,
    268             'capability_type' => 'block',
    269             'capabilities'    => array(
     263            'public'                => false,
     264            '_builtin'              => true, /* internal use only. don't use this when registering your own post type. */
     265            'show_ui'               => true,
     266            'show_in_menu'          => false,
     267            'rewrite'               => false,
     268            'show_in_rest'          => true,
     269            'rest_base'             => 'blocks',
     270            'rest_controller_class' => 'WP_REST_Blocks_Controller',
     271            'capability_type'       => 'block',
     272            'capabilities'          => array(
    270273                // You need to be able to edit posts, in order to read blocks in their raw form.
    271274                'read'                   => 'edit_posts',
     
    277280                'delete_others_posts'    => 'delete_others_posts',
    278281            ),
    279             'map_meta_cap'    => true,
    280             'supports'        => array(
     282            'map_meta_cap'          => true,
     283            'supports'              => array(
    281284                'title',
    282285                'editor',
  • trunk/src/wp-includes/rest-api.php

    r44126 r44150  
    250250    $controller->register_routes();
    251251
     252    // Block Renderer.
     253    $controller = new WP_REST_Block_Renderer_Controller;
     254    $controller->register_routes();
     255
    252256    // Settings.
    253257    $controller = new WP_REST_Settings_Controller;
     
    257261    $controller = new WP_REST_Themes_Controller;
    258262    $controller->register_routes();
     263
    259264}
    260265
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php

    r43805 r44150  
    9494                return new WP_Error(
    9595                    'block_cannot_read',
    96                     __( 'Sorry, you are not allowed to read blocks of this post' ),
     96                    __( 'Sorry, you are not allowed to read blocks of this post.' ),
    9797                    array(
    9898                        'status' => rest_authorization_required_code(),
  • trunk/src/wp-settings.php

    r44126 r44150  
    237237require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-comments-controller.php' );
    238238require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-search-controller.php' );
     239require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-blocks-controller.php' );
     240require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-renderer-controller.php' );
    239241require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-settings-controller.php' );
    240242require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-themes-controller.php' );
  • trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r44126 r44150  
    100100            '/wp/v2/media',
    101101            '/wp/v2/media/(?P<id>[\\d]+)',
     102            '/wp/v2/blocks',
     103            '/wp/v2/blocks/(?P<id>[\d]+)',
     104            '/wp/v2/blocks/(?P<parent>[\d]+)/autosaves',
     105            '/wp/v2/blocks/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)',
    102106            '/wp/v2/types',
    103107            '/wp/v2/types/(?P<type>[\\w-]+)',
     
    116120            '/wp/v2/comments/(?P<id>[\\d]+)',
    117121            '/wp/v2/search',
     122            '/wp/v2/block-renderer/(?P<name>core/block)',
     123            '/wp/v2/block-renderer/(?P<name>core/latest-comments)',
     124            '/wp/v2/block-renderer/(?P<name>core/archives)',
     125            '/wp/v2/block-renderer/(?P<name>core/categories)',
     126            '/wp/v2/block-renderer/(?P<name>core/latest-posts)',
     127            '/wp/v2/block-renderer/(?P<name>core/shortcode)',
    118128            '/wp/v2/settings',
    119129            '/wp/v2/themes',
  • trunk/tests/qunit/fixtures/wp-api-generated.js

    r44127 r44150  
    22722272            ]
    22732273        },
     2274        "/wp/v2/blocks": {
     2275            "namespace": "wp/v2",
     2276            "methods": [
     2277                "GET",
     2278                "POST"
     2279            ],
     2280            "endpoints": [
     2281                {
     2282                    "methods": [
     2283                        "GET"
     2284                    ],
     2285                    "args": {
     2286                        "context": {
     2287                            "required": false,
     2288                            "default": "view",
     2289                            "enum": [
     2290                                "view",
     2291                                "embed",
     2292                                "edit"
     2293                            ],
     2294                            "description": "Scope under which the request is made; determines fields present in response.",
     2295                            "type": "string"
     2296                        },
     2297                        "page": {
     2298                            "required": false,
     2299                            "default": 1,
     2300                            "description": "Current page of the collection.",
     2301                            "type": "integer"
     2302                        },
     2303                        "per_page": {
     2304                            "required": false,
     2305                            "default": 10,
     2306                            "description": "Maximum number of items to be returned in result set.",
     2307                            "type": "integer"
     2308                        },
     2309                        "search": {
     2310                            "required": false,
     2311                            "description": "Limit results to those matching a string.",
     2312                            "type": "string"
     2313                        },
     2314                        "after": {
     2315                            "required": false,
     2316                            "description": "Limit response to posts published after a given ISO8601 compliant date.",
     2317                            "type": "string"
     2318                        },
     2319                        "before": {
     2320                            "required": false,
     2321                            "description": "Limit response to posts published before a given ISO8601 compliant date.",
     2322                            "type": "string"
     2323                        },
     2324                        "exclude": {
     2325                            "required": false,
     2326                            "default": [],
     2327                            "description": "Ensure result set excludes specific IDs.",
     2328                            "type": "array",
     2329                            "items": {
     2330                                "type": "integer"
     2331                            }
     2332                        },
     2333                        "include": {
     2334                            "required": false,
     2335                            "default": [],
     2336                            "description": "Limit result set to specific IDs.",
     2337                            "type": "array",
     2338                            "items": {
     2339                                "type": "integer"
     2340                            }
     2341                        },
     2342                        "offset": {
     2343                            "required": false,
     2344                            "description": "Offset the result set by a specific number of items.",
     2345                            "type": "integer"
     2346                        },
     2347                        "order": {
     2348                            "required": false,
     2349                            "default": "desc",
     2350                            "enum": [
     2351                                "asc",
     2352                                "desc"
     2353                            ],
     2354                            "description": "Order sort attribute ascending or descending.",
     2355                            "type": "string"
     2356                        },
     2357                        "orderby": {
     2358                            "required": false,
     2359                            "default": "date",
     2360                            "enum": [
     2361                                "author",
     2362                                "date",
     2363                                "id",
     2364                                "include",
     2365                                "modified",
     2366                                "parent",
     2367                                "relevance",
     2368                                "slug",
     2369                                "include_slugs",
     2370                                "title"
     2371                            ],
     2372                            "description": "Sort collection by object attribute.",
     2373                            "type": "string"
     2374                        },
     2375                        "slug": {
     2376                            "required": false,
     2377                            "description": "Limit result set to posts with one or more specific slugs.",
     2378                            "type": "array",
     2379                            "items": {
     2380                                "type": "string"
     2381                            }
     2382                        },
     2383                        "status": {
     2384                            "required": false,
     2385                            "default": "publish",
     2386                            "description": "Limit result set to posts assigned one or more statuses.",
     2387                            "type": "array",
     2388                            "items": {
     2389                                "enum": [
     2390                                    "publish",
     2391                                    "future",
     2392                                    "draft",
     2393                                    "pending",
     2394                                    "private",
     2395                                    "trash",
     2396                                    "auto-draft",
     2397                                    "inherit",
     2398                                    "request-pending",
     2399                                    "request-confirmed",
     2400                                    "request-failed",
     2401                                    "request-completed",
     2402                                    "any"
     2403                                ],
     2404                                "type": "string"
     2405                            }
     2406                        }
     2407                    }
     2408                },
     2409                {
     2410                    "methods": [
     2411                        "POST"
     2412                    ],
     2413                    "args": {
     2414                        "date": {
     2415                            "required": false,
     2416                            "description": "The date the object was published, in the site's timezone.",
     2417                            "type": "string"
     2418                        },
     2419                        "date_gmt": {
     2420                            "required": false,
     2421                            "description": "The date the object was published, as GMT.",
     2422                            "type": "string"
     2423                        },
     2424                        "slug": {
     2425                            "required": false,
     2426                            "description": "An alphanumeric identifier for the object unique to its type.",
     2427                            "type": "string"
     2428                        },
     2429                        "status": {
     2430                            "required": false,
     2431                            "enum": [
     2432                                "publish",
     2433                                "future",
     2434                                "draft",
     2435                                "pending",
     2436                                "private"
     2437                            ],
     2438                            "description": "A named status for the object.",
     2439                            "type": "string"
     2440                        },
     2441                        "password": {
     2442                            "required": false,
     2443                            "description": "A password to protect access to the content and excerpt.",
     2444                            "type": "string"
     2445                        },
     2446                        "title": {
     2447                            "required": false,
     2448                            "description": "The title for the object.",
     2449                            "type": "object"
     2450                        },
     2451                        "content": {
     2452                            "required": false,
     2453                            "description": "The content for the object.",
     2454                            "type": "object"
     2455                        },
     2456                        "template": {
     2457                            "required": false,
     2458                            "description": "The theme file to use to display the object.",
     2459                            "type": "string"
     2460                        }
     2461                    }
     2462                }
     2463            ],
     2464            "_links": {
     2465                "self": "http://example.org/index.php?rest_route=/wp/v2/blocks"
     2466            }
     2467        },
     2468        "/wp/v2/blocks/(?P<id>[\\d]+)": {
     2469            "namespace": "wp/v2",
     2470            "methods": [
     2471                "GET",
     2472                "POST",
     2473                "PUT",
     2474                "PATCH",
     2475                "DELETE"
     2476            ],
     2477            "endpoints": [
     2478                {
     2479                    "methods": [
     2480                        "GET"
     2481                    ],
     2482                    "args": {
     2483                        "id": {
     2484                            "required": false,
     2485                            "description": "Unique identifier for the object.",
     2486                            "type": "integer"
     2487                        },
     2488                        "context": {
     2489                            "required": false,
     2490                            "default": "view",
     2491                            "enum": [
     2492                                "view",
     2493                                "embed",
     2494                                "edit"
     2495                            ],
     2496                            "description": "Scope under which the request is made; determines fields present in response.",
     2497                            "type": "string"
     2498                        },
     2499                        "password": {
     2500                            "required": false,
     2501                            "description": "The password for the post if it is password protected.",
     2502                            "type": "string"
     2503                        }
     2504                    }
     2505                },
     2506                {
     2507                    "methods": [
     2508                        "POST",
     2509                        "PUT",
     2510                        "PATCH"
     2511                    ],
     2512                    "args": {
     2513                        "id": {
     2514                            "required": false,
     2515                            "description": "Unique identifier for the object.",
     2516                            "type": "integer"
     2517                        },
     2518                        "date": {
     2519                            "required": false,
     2520                            "description": "The date the object was published, in the site's timezone.",
     2521                            "type": "string"
     2522                        },
     2523                        "date_gmt": {
     2524                            "required": false,
     2525                            "description": "The date the object was published, as GMT.",
     2526                            "type": "string"
     2527                        },
     2528                        "slug": {
     2529                            "required": false,
     2530                            "description": "An alphanumeric identifier for the object unique to its type.",
     2531                            "type": "string"
     2532                        },
     2533                        "status": {
     2534                            "required": false,
     2535                            "enum": [
     2536                                "publish",
     2537                                "future",
     2538                                "draft",
     2539                                "pending",
     2540                                "private"
     2541                            ],
     2542                            "description": "A named status for the object.",
     2543                            "type": "string"
     2544                        },
     2545                        "password": {
     2546                            "required": false,
     2547                            "description": "A password to protect access to the content and excerpt.",
     2548                            "type": "string"
     2549                        },
     2550                        "title": {
     2551                            "required": false,
     2552                            "description": "The title for the object.",
     2553                            "type": "object"
     2554                        },
     2555                        "content": {
     2556                            "required": false,
     2557                            "description": "The content for the object.",
     2558                            "type": "object"
     2559                        },
     2560                        "template": {
     2561                            "required": false,
     2562                            "description": "The theme file to use to display the object.",
     2563                            "type": "string"
     2564                        }
     2565                    }
     2566                },
     2567                {
     2568                    "methods": [
     2569                        "DELETE"
     2570                    ],
     2571                    "args": {
     2572                        "id": {
     2573                            "required": false,
     2574                            "description": "Unique identifier for the object.",
     2575                            "type": "integer"
     2576                        },
     2577                        "force": {
     2578                            "required": false,
     2579                            "default": false,
     2580                            "description": "Whether to bypass trash and force deletion.",
     2581                            "type": "boolean"
     2582                        }
     2583                    }
     2584                }
     2585            ]
     2586        },
     2587        "/wp/v2/blocks/(?P<parent>[\\d]+)/autosaves": {
     2588            "namespace": "wp/v2",
     2589            "methods": [
     2590                "GET",
     2591                "POST"
     2592            ],
     2593            "endpoints": [
     2594                {
     2595                    "methods": [
     2596                        "GET"
     2597                    ],
     2598                    "args": {
     2599                        "parent": {
     2600                            "required": false,
     2601                            "description": "The ID for the parent of the object.",
     2602                            "type": "integer"
     2603                        },
     2604                        "context": {
     2605                            "required": false,
     2606                            "default": "view",
     2607                            "enum": [
     2608                                "view",
     2609                                "embed",
     2610                                "edit"
     2611                            ],
     2612                            "description": "Scope under which the request is made; determines fields present in response.",
     2613                            "type": "string"
     2614                        },
     2615                        "page": {
     2616                            "required": false,
     2617                            "default": 1,
     2618                            "description": "Current page of the collection.",
     2619                            "type": "integer"
     2620                        },
     2621                        "per_page": {
     2622                            "required": false,
     2623                            "description": "Maximum number of items to be returned in result set.",
     2624                            "type": "integer"
     2625                        },
     2626                        "search": {
     2627                            "required": false,
     2628                            "description": "Limit results to those matching a string.",
     2629                            "type": "string"
     2630                        },
     2631                        "exclude": {
     2632                            "required": false,
     2633                            "default": [],
     2634                            "description": "Ensure result set excludes specific IDs.",
     2635                            "type": "array",
     2636                            "items": {
     2637                                "type": "integer"
     2638                            }
     2639                        },
     2640                        "include": {
     2641                            "required": false,
     2642                            "default": [],
     2643                            "description": "Limit result set to specific IDs.",
     2644                            "type": "array",
     2645                            "items": {
     2646                                "type": "integer"
     2647                            }
     2648                        },
     2649                        "offset": {
     2650                            "required": false,
     2651                            "description": "Offset the result set by a specific number of items.",
     2652                            "type": "integer"
     2653                        },
     2654                        "order": {
     2655                            "required": false,
     2656                            "default": "desc",
     2657                            "enum": [
     2658                                "asc",
     2659                                "desc"
     2660                            ],
     2661                            "description": "Order sort attribute ascending or descending.",
     2662                            "type": "string"
     2663                        },
     2664                        "orderby": {
     2665                            "required": false,
     2666                            "default": "date",
     2667                            "enum": [
     2668                                "date",
     2669                                "id",
     2670                                "include",
     2671                                "relevance",
     2672                                "slug",
     2673                                "include_slugs",
     2674                                "title"
     2675                            ],
     2676                            "description": "Sort collection by object attribute.",
     2677                            "type": "string"
     2678                        }
     2679                    }
     2680                },
     2681                {
     2682                    "methods": [
     2683                        "POST"
     2684                    ],
     2685                    "args": {
     2686                        "parent": {
     2687                            "required": false,
     2688                            "description": "The ID for the parent of the object.",
     2689                            "type": "integer"
     2690                        },
     2691                        "author": {
     2692                            "required": false,
     2693                            "description": "The ID for the author of the object.",
     2694                            "type": "integer"
     2695                        },
     2696                        "date": {
     2697                            "required": false,
     2698                            "description": "The date the object was published, in the site's timezone.",
     2699                            "type": "string"
     2700                        },
     2701                        "date_gmt": {
     2702                            "required": false,
     2703                            "description": "The date the object was published, as GMT.",
     2704                            "type": "string"
     2705                        },
     2706                        "id": {
     2707                            "required": false,
     2708                            "description": "Unique identifier for the object.",
     2709                            "type": "integer"
     2710                        },
     2711                        "modified": {
     2712                            "required": false,
     2713                            "description": "The date the object was last modified, in the site's timezone.",
     2714                            "type": "string"
     2715                        },
     2716                        "modified_gmt": {
     2717                            "required": false,
     2718                            "description": "The date the object was last modified, as GMT.",
     2719                            "type": "string"
     2720                        },
     2721                        "slug": {
     2722                            "required": false,
     2723                            "description": "An alphanumeric identifier for the object unique to its type.",
     2724                            "type": "string"
     2725                        },
     2726                        "title": {
     2727                            "required": false,
     2728                            "description": "The title for the object.",
     2729                            "type": "object"
     2730                        },
     2731                        "content": {
     2732                            "required": false,
     2733                            "description": "The content for the object.",
     2734                            "type": "object"
     2735                        }
     2736                    }
     2737                }
     2738            ]
     2739        },
     2740        "/wp/v2/blocks/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)": {
     2741            "namespace": "wp/v2",
     2742            "methods": [
     2743                "GET"
     2744            ],
     2745            "endpoints": [
     2746                {
     2747                    "methods": [
     2748                        "GET"
     2749                    ],
     2750                    "args": {
     2751                        "parent": {
     2752                            "required": false,
     2753                            "description": "The ID for the parent of the object.",
     2754                            "type": "integer"
     2755                        },
     2756                        "id": {
     2757                            "required": false,
     2758                            "description": "The ID for the object.",
     2759                            "type": "integer"
     2760                        },
     2761                        "context": {
     2762                            "required": false,
     2763                            "default": "view",
     2764                            "enum": [
     2765                                "view",
     2766                                "embed",
     2767                                "edit"
     2768                            ],
     2769                            "description": "Scope under which the request is made; determines fields present in response.",
     2770                            "type": "string"
     2771                        }
     2772                    }
     2773                }
     2774            ]
     2775        },
    22742776        "/wp/v2/types": {
    22752777            "namespace": "wp/v2",
     
    38654367                "self": "http://example.org/index.php?rest_route=/wp/v2/search"
    38664368            }
     4369        },
     4370        "/wp/v2/block-renderer/(?P<name>core/block)": {
     4371            "namespace": "wp/v2",
     4372            "methods": [
     4373                "GET"
     4374            ],
     4375            "endpoints": [
     4376                {
     4377                    "methods": [
     4378                        "GET"
     4379                    ],
     4380                    "args": {
     4381                        "name": {
     4382                            "required": false,
     4383                            "description": "Unique registered name for the block.",
     4384                            "type": "string"
     4385                        },
     4386                        "context": {
     4387                            "required": false,
     4388                            "default": "view",
     4389                            "enum": [
     4390                                "edit"
     4391                            ],
     4392                            "description": "Scope under which the request is made; determines fields present in response.",
     4393                            "type": "string"
     4394                        },
     4395                        "attributes": {
     4396                            "required": false,
     4397                            "description": "Attributes for core/block block",
     4398                            "type": "object"
     4399                        },
     4400                        "post_id": {
     4401                            "required": false,
     4402                            "description": "ID of the post context.",
     4403                            "type": "integer"
     4404                        }
     4405                    }
     4406                }
     4407            ]
     4408        },
     4409        "/wp/v2/block-renderer/(?P<name>core/latest-comments)": {
     4410            "namespace": "wp/v2",
     4411            "methods": [
     4412                "GET"
     4413            ],
     4414            "endpoints": [
     4415                {
     4416                    "methods": [
     4417                        "GET"
     4418                    ],
     4419                    "args": {
     4420                        "name": {
     4421                            "required": false,
     4422                            "description": "Unique registered name for the block.",
     4423                            "type": "string"
     4424                        },
     4425                        "context": {
     4426                            "required": false,
     4427                            "default": "view",
     4428                            "enum": [
     4429                                "edit"
     4430                            ],
     4431                            "description": "Scope under which the request is made; determines fields present in response.",
     4432                            "type": "string"
     4433                        },
     4434                        "attributes": {
     4435                            "required": false,
     4436                            "description": "Attributes for core/latest-comments block",
     4437                            "type": "object"
     4438                        },
     4439                        "post_id": {
     4440                            "required": false,
     4441                            "description": "ID of the post context.",
     4442                            "type": "integer"
     4443                        }
     4444                    }
     4445                }
     4446            ]
     4447        },
     4448        "/wp/v2/block-renderer/(?P<name>core/archives)": {
     4449            "namespace": "wp/v2",
     4450            "methods": [
     4451                "GET"
     4452            ],
     4453            "endpoints": [
     4454                {
     4455                    "methods": [
     4456                        "GET"
     4457                    ],
     4458                    "args": {
     4459                        "name": {
     4460                            "required": false,
     4461                            "description": "Unique registered name for the block.",
     4462                            "type": "string"
     4463                        },
     4464                        "context": {
     4465                            "required": false,
     4466                            "default": "view",
     4467                            "enum": [
     4468                                "edit"
     4469                            ],
     4470                            "description": "Scope under which the request is made; determines fields present in response.",
     4471                            "type": "string"
     4472                        },
     4473                        "attributes": {
     4474                            "required": false,
     4475                            "description": "Attributes for core/archives block",
     4476                            "type": "object"
     4477                        },
     4478                        "post_id": {
     4479                            "required": false,
     4480                            "description": "ID of the post context.",
     4481                            "type": "integer"
     4482                        }
     4483                    }
     4484                }
     4485            ]
     4486        },
     4487        "/wp/v2/block-renderer/(?P<name>core/categories)": {
     4488            "namespace": "wp/v2",
     4489            "methods": [
     4490                "GET"
     4491            ],
     4492            "endpoints": [
     4493                {
     4494                    "methods": [
     4495                        "GET"
     4496                    ],
     4497                    "args": {
     4498                        "name": {
     4499                            "required": false,
     4500                            "description": "Unique registered name for the block.",
     4501                            "type": "string"
     4502                        },
     4503                        "context": {
     4504                            "required": false,
     4505                            "default": "view",
     4506                            "enum": [
     4507                                "edit"
     4508                            ],
     4509                            "description": "Scope under which the request is made; determines fields present in response.",
     4510                            "type": "string"
     4511                        },
     4512                        "attributes": {
     4513                            "required": false,
     4514                            "description": "Attributes for core/categories block",
     4515                            "type": "object"
     4516                        },
     4517                        "post_id": {
     4518                            "required": false,
     4519                            "description": "ID of the post context.",
     4520                            "type": "integer"
     4521                        }
     4522                    }
     4523                }
     4524            ]
     4525        },
     4526        "/wp/v2/block-renderer/(?P<name>core/latest-posts)": {
     4527            "namespace": "wp/v2",
     4528            "methods": [
     4529                "GET"
     4530            ],
     4531            "endpoints": [
     4532                {
     4533                    "methods": [
     4534                        "GET"
     4535                    ],
     4536                    "args": {
     4537                        "name": {
     4538                            "required": false,
     4539                            "description": "Unique registered name for the block.",
     4540                            "type": "string"
     4541                        },
     4542                        "context": {
     4543                            "required": false,
     4544                            "default": "view",
     4545                            "enum": [
     4546                                "edit"
     4547                            ],
     4548                            "description": "Scope under which the request is made; determines fields present in response.",
     4549                            "type": "string"
     4550                        },
     4551                        "attributes": {
     4552                            "required": false,
     4553                            "description": "Attributes for core/latest-posts block",
     4554                            "type": "object"
     4555                        },
     4556                        "post_id": {
     4557                            "required": false,
     4558                            "description": "ID of the post context.",
     4559                            "type": "integer"
     4560                        }
     4561                    }
     4562                }
     4563            ]
     4564        },
     4565        "/wp/v2/block-renderer/(?P<name>core/shortcode)": {
     4566            "namespace": "wp/v2",
     4567            "methods": [
     4568                "GET"
     4569            ],
     4570            "endpoints": [
     4571                {
     4572                    "methods": [
     4573                        "GET"
     4574                    ],
     4575                    "args": {
     4576                        "name": {
     4577                            "required": false,
     4578                            "description": "Unique registered name for the block.",
     4579                            "type": "string"
     4580                        },
     4581                        "context": {
     4582                            "required": false,
     4583                            "default": "view",
     4584                            "enum": [
     4585                                "edit"
     4586                            ],
     4587                            "description": "Scope under which the request is made; determines fields present in response.",
     4588                            "type": "string"
     4589                        },
     4590                        "attributes": {
     4591                            "required": false,
     4592                            "description": "Attributes for core/shortcode block",
     4593                            "type": "object"
     4594                        },
     4595                        "post_id": {
     4596                            "required": false,
     4597                            "description": "ID of the post context.",
     4598                            "type": "integer"
     4599                        }
     4600                    }
     4601                }
     4602            ]
    38674603        },
    38684604        "/wp/v2/settings": {
     
    43485084    },
    43495085    {
    4350         "author": 359,
     5086        "author": 375,
    43515087        "date": "2017-02-14T00:00:00",
    43525088        "date_gmt": "2017-02-14T00:00:00",
    4353         "id": 3153,
     5089        "id": 36744,
    43545090        "modified": "2017-02-14T00:00:00",
    43555091        "modified_gmt": "2017-02-14T00:00:00",
    4356         "parent": 3152,
    4357         "slug": "3152-revision-v1",
     5092        "parent": 36743,
     5093        "slug": "36743-revision-v1",
    43585094        "guid": {
    4359             "rendered": "http://example.org/?p=3153"
     5095            "rendered": "http://example.org/?p=36744"
    43605096        },
    43615097        "title": {
     
    43715107            "parent": [
    43725108                {
    4373                     "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3152"
     5109                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/36743"
    43745110                }
    43755111            ]
     
    44035139mockedApiResponse.postAutosaves = [
    44045140    {
    4405         "author": 359,
     5141        "author": 375,
    44065142        "date": "2017-02-14T00:00:00",
    44075143        "date_gmt": "2017-02-14T00:00:00",
    4408         "id": 3154,
     5144        "id": 36745,
    44095145        "modified": "2017-02-14T00:00:00",
    44105146        "modified_gmt": "2017-02-14T00:00:00",
    4411         "parent": 3152,
    4412         "slug": "3152-autosave-v1",
     5147        "parent": 36743,
     5148        "slug": "36743-autosave-v1",
    44135149        "guid": {
    4414             "rendered": "http://example.org/?p=3154"
     5150            "rendered": "http://example.org/?p=36745"
    44155151        },
    44165152        "title": {
     
    44265162            "parent": [
    44275163                {
    4428                     "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3152"
     5164                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/36743"
    44295165                }
    44305166            ]
     
    44345170
    44355171mockedApiResponse.autosave = {
    4436     "author": 359,
     5172    "author": 375,
    44375173    "date": "2017-02-14T00:00:00",
    44385174    "date_gmt": "2017-02-14T00:00:00",
    4439     "id": 3154,
     5175    "id": 36745,
    44405176    "modified": "2017-02-14T00:00:00",
    44415177    "modified_gmt": "2017-02-14T00:00:00",
    4442     "parent": 3152,
    4443     "slug": "3152-autosave-v1",
     5178    "parent": 36743,
     5179    "slug": "36743-autosave-v1",
    44445180    "guid": {
    4445         "rendered": "http://example.org/?p=3154"
     5181        "rendered": "http://example.org/?p=36745"
    44465182    },
    44475183    "title": {
     
    46085344    },
    46095345    {
    4610         "author": 359,
     5346        "author": 375,
    46115347        "date": "2017-02-14T00:00:00",
    46125348        "date_gmt": "2017-02-14T00:00:00",
    4613         "id": 3156,
     5349        "id": 36747,
    46145350        "modified": "2017-02-14T00:00:00",
    46155351        "modified_gmt": "2017-02-14T00:00:00",
    4616         "parent": 3155,
    4617         "slug": "3155-revision-v1",
     5352        "parent": 36746,
     5353        "slug": "36746-revision-v1",
    46185354        "guid": {
    4619             "rendered": "http://example.org/?p=3156"
     5355            "rendered": "http://example.org/?p=36747"
    46205356        },
    46215357        "title": {
     
    46315367            "parent": [
    46325368                {
    4633                     "href": "http://example.org/index.php?rest_route=/wp/v2/pages/3155"
     5369                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/36746"
    46345370                }
    46355371            ]
     
    46635399mockedApiResponse.pageAutosaves = [
    46645400    {
    4665         "author": 359,
     5401        "author": 375,
    46665402        "date": "2017-02-14T00:00:00",
    46675403        "date_gmt": "2017-02-14T00:00:00",
    4668         "id": 3157,
     5404        "id": 36748,
    46695405        "modified": "2017-02-14T00:00:00",
    46705406        "modified_gmt": "2017-02-14T00:00:00",
    4671         "parent": 3155,
    4672         "slug": "3155-autosave-v1",
     5407        "parent": 36746,
     5408        "slug": "36746-autosave-v1",
    46735409        "guid": {
    4674             "rendered": "http://example.org/?p=3157"
     5410            "rendered": "http://example.org/?p=36748"
    46755411        },
    46765412        "title": {
     
    46865422            "parent": [
    46875423                {
    4688                     "href": "http://example.org/index.php?rest_route=/wp/v2/pages/3155"
     5424                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/36746"
    46895425                }
    46905426            ]
     
    46945430
    46955431mockedApiResponse.pageAutosave = {
    4696     "author": 359,
     5432    "author": 375,
    46975433    "date": "2017-02-14T00:00:00",
    46985434    "date_gmt": "2017-02-14T00:00:00",
    4699     "id": 3157,
     5435    "id": 36748,
    47005436    "modified": "2017-02-14T00:00:00",
    47015437    "modified_gmt": "2017-02-14T00:00:00",
    4702     "parent": 3155,
    4703     "slug": "3155-autosave-v1",
     5438    "parent": 36746,
     5439    "slug": "36746-autosave-v1",
    47045440    "guid": {
    4705         "rendered": "http://example.org/?p=3157"
     5441        "rendered": "http://example.org/?p=36748"
    47065442    },
    47075443    "title": {
     
    48995635            ]
    49005636        }
     5637    },
     5638    "wp_block": {
     5639        "description": "",
     5640        "hierarchical": false,
     5641        "name": "Blocks",
     5642        "slug": "wp_block",
     5643        "taxonomies": [],
     5644        "rest_base": "blocks",
     5645        "_links": {
     5646            "collection": [
     5647                {
     5648                    "href": "http://example.org/index.php?rest_route=/wp/v2/types"
     5649                }
     5650            ],
     5651            "wp:items": [
     5652                {
     5653                    "href": "http://example.org/index.php?rest_route=/wp/v2/blocks"
     5654                }
     5655            ],
     5656            "curies": [
     5657                {
     5658                    "name": "wp",
     5659                    "href": "https://api.w.org/{rel}",
     5660                    "templated": true
     5661                }
     5662            ]
     5663        }
    49015664    }
    49025665};
Note: See TracChangeset for help on using the changeset viewer.