How to use REST API ?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1473941
    STONE TYLER
    Participant

    Hello, I’m very confused about the REST API Documentation. on my website, I’ve just created the API Keys in Accommodation > Settings > Advanced, And the QR Code gave me a url ink of :

    https://my_webite.com/wp-json/mphb/v1%7C [API_KEY] %7C [API_SECRET]

    However this alone gives an error of :

    {“code”:”rest_no_route”,”message”:”No route was found matching the URL and request method.”,”data”:{“status”:404}}

    Using the REST API Docs, I’ve tried using that URL as the endpoint and appending /bookings at the end it, But It’s still giving me the same response. ie :

    https://my_webite.com/wp-json/mphb/v1%7C [API_KEY] %7C [API_SECRET] /bookings

    Then in the Docs, It says something about this id :

    hbdemo.getmotopress.com/z8p5rxxxx7xfeck/wp-admin , Where z8p5rxxxx7xfeck is the demo-id .

    I’m incredibly frustrated at this. WHAT IS THE ENDPOINT ??? I’ve been asking our wordpress developer for over 2 months now to just tell me WHAT IS THE ENDPOINT FOR THIS API ????? and I haven’t gotten a single response. Is this Demo-id part applicable to a Live website’s REST API or is it JUST for testing purposes. If it’s ONLY for some BS Authorization on a demo website and doesn’t exist in a production environment API endpoint, which I suspect is the case, Please make that very clear and PUT A REAL PRODUCTION ENVIRONMENT API EXAMPLE !

    The API Page Description also states :

    “The Consumer Key and Consumer Secret may be entered in the application using the Hotel Booking API”

    WHERE DO I ENTER THESE CREDENTIALS INTO THE APPLICATION THEN? What is “The Application”? The Hotel Booking WordPress Application, which somehow gives access to the API in a different location, Or An External 3rd Party Application using the Rest API to get the Data?

    For the 80th time in the past 2 months, WHAT IS URL ENDPOINT FOR THIS API ????

    Apologies as I myself am extremely unfamiliar with WordPress.

    #1474079
    STONE TYLER
    Participant

    I’m trying to post a response to this with the answer and it’s not showing up ………

    I’ve always worked in code and frameworks for the last 10 years. I’ve never really given wordpress a chance, but doing so in a real project for my company for the first time, Just wow, Incredibly confusing, ambiguous and frustrating at every level. What’s happening, And Where, And Why? Nobody’s telling me because apparently Nobody seems to know. Is working in wordpress this garbage all the time? I’ve never had such a hard time finding a basic answer to a simple question in my entire career. I’ve also never seen so many things so easily broken in my entire career.

    Sorry to rant like this on a random thread about a thing nobody’s going to even see, But this is a level of bad on the internet that I haven’t seen since 2005.

    #1474081
    STONE TYLER
    Participant

    I’ve finally resolved this myself.

    ENDPOINT : https://my_webite.com/wp-json/mphb/v1/bookings

    Required : Basic Authentication
    ** DISABLED AS URL IN GOOGLE CHROME AND OTHER BROWSERS **

    Via Curl (Successful):
    curl –user “API_KEY:API_SECRET” https://my_webite.com/wp-json/mphb/v1/bookings

    It’d be great if you could Add this information to the REST API Documentation so other users don’t need to spend Hours to Months trying to figure it out blind and from scratch.

    #1474090
    STONE TYLER
    Participant

    Okay and now, For WHATEVER THE REASON, Because NOBODY KNOWS WHAT THAT REASON IS, my ability to Edit posts has disappeared. Wonderful User experience here. *clap* *clap* *clap*

    #1474091
    STONE TYLER
    Participant

    ** DISABLED AS URL IN GOOGLE CHROME AND OTHER BROWSERS **
    FOR SOME REASON PUTTING A BASIC AUTH URL IN THE TEXT HERE BREAKS THE POST. The format is https:// Followed by your API_KEY Then : Then API_SECRET Then @ Then The Endpoint URL my_webite.com/wp-json/mphb/v1/bookings. Does that work for you random 3rd party form security filter plugin? Thanks for giving me ABSOLUTELY ZERO WARNING OR NOTIFICATION OR ERROR whatsoever, just Randomly break, and Like everything in wordpress leave me to blindly guess at and stumble upon the answer on my own and find a workaround based on that.

    EDIT : Somehow, NO, It didn’t let me EDIT this into the original post. And took away my edit ability. But it DID let me post it into a new post, And let me edit it here. Where’s the Logic? Nowhere, This is wordpress!

    If it’ll just let me post this I’ll be done.

    #1476136
    J. Davis
    Keymaster

    Hi Stone,

    Thanks for your questions. In order to use REST API you need to have some basic knowledge on how to use it. Please try using Postman or other software for testing API requests.
    As for the ID of HBDemo so it is for the users who do not have a Hotel Booking plugin yet and want to test Rest API with our trial demo before the purchase. Could you please clarify what exactly you try to achieve by using REST API and what exactly questions or difficulties you have?

    best regards,
    John Davis

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.