Rest Api namespace for pod not working
-
After creating a pod and enabling Rest API and updated the REST API namespace to a custom namespace but my custom namespace is still not working. What am I doing wrong?
-
Hi @msowah
Please share some config and code so we can see what you did ??
Did you check the documentation?
https://docs.pods.io/advanced-topics/rest-api/Cheers, Jory
@msowah You can share your exact config by copy-and-pasting the package export text from
Pods > Components > Import / Export Packages
In testing @keraweb, I created a Pod called “test”, then set the REST API namespace to
xyz/v1
. After doing this, the Pod was still showing at/wp-json/wp/v2/test
, and still returned 404 when accessed at/wp-json/xyz/v1/test
. This was also the case after saving Permalinks, clearing Pods cache, running the repair tool, and saving the pod again —?trying the custom route still returned 404rest_no_route
.Pods config for the test:
{ "@meta": { "version": "2.9.10.1", "build": 1671023857 }, "settings": { "types_only": "0", "watch_changed_fields": "0", "metadata_integration": "1", "metadata_override_get": "0", "session_auto_start": "0", "wisdom_opt_out": "1" }, "pods": [ { "name": "test", "id": 4, "label": "Tests", "description": "", "type": "post_type", "storage": "meta", "label_singular": "Test", "public": "1", "show_ui": "1", "rest_enable": "1", "supports_title": "1", "supports_editor": "1", "_migrated_28": "1", "write_all": "test", "rest_api_field_mode": "value", "rest_namespace": "xyz\/v1", "groups": [ { "name": "more_fields", "id": 5, "label": "More Fields", "description": "", "weight": 0, "fields": [] } ] } ] }
- This reply was modified 1 year, 11 months ago by Paul Clark.
Hello @pdclark, I created a pod, enabled RESt Api, and changed the namespace but when I use the new namespace, it does not work, it gives me the error
{ "code": "rest_no_route", "message": "No route was found matching the URL and request method.", "data": { "status": 404 } }
{ "@meta": { "version": "2.9.10.1", "build": 1671025985 }, "settings": { "types_only": "0", "watch_changed_fields": "0", "metadata_integration": "1", "metadata_override_get": "0", "session_auto_start": "0", "wisdom_opt_out": "1" }, "pods": [ { "name": "parps", "id": 160, "label": "Parps", "description": "", "type": "post_type", "storage": "table", "label_singular": "Parp", "public": "1", "show_ui": "1", "rest_enable": "1", "supports_title": "1", "supports_editor": "1", "_migrated_28": "0", "meta_box_context": "normal", "meta_box_priority": "default", "required": "0", "unique": "0", "write_all": "parps", "rest_api_field_mode": "value", "read_all": "1", "rest_namespace": "\/v1", "show_in_menu": "1", "built_in_taxonomies_category_parps": "1", "supports_post_formats": "1", "supports_author": "1", "publicly_queryable": "1", "capability_type_extra": "1", "capability_type": "post", "can_export": "1", "rewrite": "1", "rewrite_with_front": "1", "default_status": "draft", "rewrite_pages": "1", "query_var": "1", "delete_with_user": "1", "menu_position": "0", "show_in_nav_menus": "1", "show_in_admin_bar": "1", "groups": [ { "name": "file", "id": 161, "label": "File", "description": "", "weight": 0, "meta_box_context": "normal", "meta_box_priority": "default", "roles_allowed": "administrator", "fields": [ { "name": "image_video", "id": 162, "label": "Add Image\/video", "description": "", "weight": 0, "type": "file", "sister_id": "-- Select One --", "required": "1", "unique": "0", "file_format_type": "single", "file_uploader": "attachment", "file_type": "images", "file_attachment_tab": "upload", "file_upload_dir": "wp", "file_edit_title": "1", "file_show_edit_link": "0", "file_linked": "0", "file_limit": "0", "file_field_template": "rows", "file_add_button": "Add File", "file_modal_title": "Attach a file", "file_modal_add_button": "Add File", "file_wp_gallery_link": "file", "file_wp_gallery_columns": "3", "file_wp_gallery_size": "thumbnail", "repeatable": "0", "repeatable_format": "default", "roles_allowed": "administrator", "rest_pick_response": "array", "rest_pick_depth": "1", "rest_write": "1", "rest_read": "1" } ] } ] } ] }
Sorry, I’m unfortunately giving you some bad news about this feature — I brought it over for compatibility with the Custom Post Type UI plugin but I didn’t hook it up ??
The good news is that I found this thread in time before our next release — and I hooked it up. It’s now officially in the upcoming Pods 2.9.10.2 release today.
- This reply was modified 1 year, 11 months ago by Scott Kingsley Clark.
Pods 2.9.10.2 is now out for you to use.
I just updated and tried it and it works now, thank you.
- The topic ‘Rest Api namespace for pod not working’ is closed to new replies.