• Resolved clementa83

    (@clementa83)


    Hello, I’m planning to use Geodirectory to build a WP based website to show various events.
    I fetch the events from various databases and have a connector to fill up the Geodirectory Events and Places. Everything should work through APIs as the amount of event is not manageable by hand.

    I’m encountering multiple problems using the API :

    1. The API authentication mechanism isn’t clear to me.
    My website is for now http Only due to lack/ unknown domain name so I assume I have to use Oath1.0
    This seems to be unable to function properly as when I try a POST request I keep receiving :
    “Invalid signature – provided signature does not match.” when using Oauth1.0 (I put consumer key +secret from my GeoDirectory -> Keys menu ).
    Error comes from php file : wp-content/plugins/geodirectory/includes/api/class-geodir-rest-authentication.php

    And “This user has no rights [..] ” when using Basic Auth.

    Beside this problem, if I bypass this check, I can do POST request properly.
    2.
    About GET Method the endpoint “/geodir/v2/events/” always returns :
    “status”:400,”params”:{“event_type”:”event_type is not of type string.”}
    Althougth regarding the doc, no parameters is requiered for this endpoint, and even if I provide the “event_type” it is not passed to the node , and error is still here.

    Error actually occurs in /wp-includes/rest-api.php which is weird to me.
    Getting :geodir/v2/places, works fine
    Posting : /geodir/v2/events/ (bypassing Oath) works fine


    I allowed my self to post both issues here as issue 2 might also be related to authentication problem.
    In both case :
    – Happens using python with “requests_oauthlib” or Postman.
    – Happens setting ‘Content-type’: ‘application/json’ or not .
    I’d be happy to know more about the status of this API as I have pretty extensive work to do with it and would not like to encounter some other problems in the futur
    Thanks a lot,
    Regards,



    • This topic was modified 8 months, 2 weeks ago by clementa83.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support alexrollin

    (@alexrollin)

    Hello,

    1) Did you try with authentication by adding consumer_key & consumer_secret parameters to request url. Ex: &consumer_key=ck_226337xxxxxxx&consumer_secret=cs_68794xxxxxxx

    2) To retrieve events with endpoint /geodir/v2/events/ use event_type parameter. Ex: event_type=upcoming. event_type should be one of from all, upcoming, ongoing, ongoing_upcoming, past, today, tomorrow, next_7_days, next_30_days, this_weekend, this_week, this_month, next_month, next_week

    If you need more help please open a ticket here https://wpgeodirectory.com/support/

    Thread Starter clementa83

    (@clementa83)

    Hi Alex, thanks for your answer,
    1)
    This is the error code when I pass parameters as header or params:
    Response: {“code”:”rest_cannot_create”,”message”:”Sorry, you are not allowed to create posts as this user.”,”data”:{“status”:401}}
    Although I have set it as read/write
    I read somewhere that request with http couldn’t be passed as parameters or headers. That’s why i initially tried using Oauth lib with passing auth = Oauth {consumer_,consumer:secret}

    Plugin Support alexrollin

    (@alexrollin)

    Hello,

    If you need more help please open a ticket here?https://wpgeodirectory.com/support/

    • This reply was modified 8 months, 1 week ago by alexrollin.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘API Documentation / errors’ is closed to new replies.