wp-json – create database entry

Tagged: ,

Viewing 1 reply thread
  • Author
    Posts
  • March 31, 2020 at 7:04 PM #40159

    Tom Dropes
    Participant

    Hi all,

    I have a WP site were I would like to grep some informations via api to Tapforms. I have a json path which is already connected and working with Zapier.

    I’m trying to find a Javascript code WITH basic API Key authorization included. With the code in the script editor in TapForms I got an authorization error. Who can help me to include the authorization code in the script:

    function fetchFromURL() {
    var xxxxx = Utils.getJsonFromUrl(‘https://myjsonpath’);
    return xxxxx[0];
    }

    fetchFromURL();

    Thank you in advance!!!

    Tom

    This is the error:

    {
    code = “rest_forbidden_context”;
    data = {
    status = 403;
    };
    message = “Sorry, you are not allowed to view entries”;
    }

    April 1, 2020 at 1:43 AM #40171

    Sam Moffatt
    Participant

    I don’t think the Javascript API currently has the depth in the request methods to make this happen. If you can specify the authentication credentials as a part of the POST request body or as a part of the query string then it should work. If you need to use basic auth, a custom header or some sort of cookie based auth, I don’t think the current API readily supports that.

    You might need to build your own bridge to handle the authentication into WordPress and then use either a query string or as a part of a POST body.

Viewing 1 reply thread

You must be logged in to reply to this topic.