• Hi, I get this message with the normal test

    The REST API encountered an error

    The REST API is one way that WordPress and other applications communicate with the server. For example, the block editor screen relies on the REST API to display and save your posts and pages.

    When testing the REST API, an error was encountered:

    REST API Endpoint: https://example.com.test/wp-json/wp/v2/types/post?context=edit
    REST API Response: (http_request_failed) cURL error 7: Failed to connect to example.com.test port 443: Connection refused

    On pasting this URL (https://example.com.test/wp-json/wp/v2/types/post?context=edit) in the browser, I get {“code”:”rest_forbidden_context”,”message”:”Sorry, you are not allowed to edit posts in this post type.”,”data”:{“status”:401}}

    If I change this URL to context=view (https://example.com.test/wp-json/wp/v2/types/post?context=view) in the browser, I get

    {“description”:””,”hierarchical”:false,”has_archive”:false,”name”:”Posts”,”slug”:”post”,”icon”:”dashicons-admin-post”,”taxonomies”:[“category”,”post_tag”],”rest_base”:”posts”,”rest_namespace”:”wp\/v2″,”_links”:{“collection”:[{“href”:”https:\/\/example.com.test\/wp-json\/wp\/v2\/types”}],”wp:items”:[{“href”:”https:\/\/example.com.test\/wp-json\/wp\/v2\/posts”}],”curies”:[{“name”:”wp”,”href”:”https:\/\/api.w.org\/{rel}”,”templated”:true}]}}

    Both seem to indicate that REST API is working, so what’s wrong and why is the test failing?

  • The topic ‘REST API seemingly works but shows test failed’ is closed to new replies.