Anyone using Insert from URL with WordPress REST API?

I'm bumping my head against a problem with the WordPress REST API.

I'm using Insert from URL to create new users in Wordpress. The basic task is simple and easy to achieve. WordPress 5.6 introduced Application Passwords, and that allows use to use Basic Authentication to POST commands to the REST API.

The trick is that I want to pass information into the user_meta table at the same time. The POST endpoint supports passing an array named "meta" but I have been trying a lot of permutations without success. Has anyone solved this problem?

Try this web page - but you might just need Google translate.
https://fmstarter.com/wordpress-rest-api-json-und-filemaker-pro/
There is a demo file as a bonus!

Cool, thanks for the pointer.

The problem turned out to be at the WordPress end, not at the FMP end. It is necessary to register custom fields before they will appear in REST API responses. And, for passing user_meta, it is necessary to add an action to the rest_insert_user hook. In my case, it was to update user meta with the custom field data.

@Malcolm I'm interested in doing something similar. Would you be interested in sharing a sample file with us? Thanks!

Yes, I'm happy to share. I'll write up the details and post it here.

1 Like

Hi, sorry to be slow to get this. When I saw your response I thought it would be a good thing to make a blog post from, because there are a few moving parts. Now I'm about to take my holidays and realised I won't get that post done before I go.

Here are the short-hand instructions:

WordPress v5.6 is Application Passwords built in. Generate a password for the user doing the remote action.

Use your preferred method for making custom fields. I use the Toolset plugin ( It's like Pods but it has good documentation and tutorials).

Now edit your theme functions file, or your plugin. You want to use the add_action function to lasso the rest_api_init hook. In this example we get all records that match is simple search condition.

add_action( 'rest_api_init', function () {

  register_rest_route( 'simple-history/v1', '/logs', array(
    'methods' => 'GET',
    'callback' => 'simple_history_get_all_logs',
    'permission_callback' => function () {
      return current_user_can( 'edit_others_posts' );
    }
  ) );
}

function simple_history_get_all_logs( $data ) {
    global $wpdb;
    $query = "SELECT * FROM `wp_simple_history` WHERE `initiator` = 'wp_user'";
    $list = $wpdb->get_results($query);
    return $list;
}

With that in place you are ready to use cURL, Postman, or Insert from URL to test your work.

(I'll be cycling from the peak of Aoraki, Mt Cook to Oamaru on the coast. It's all downhill for me :slightly_smiling_face:)