Creating a New Place is Not Working

This topic contains 11 replies, has 3 voices, and was last updated by  Kiran 4 years, 11 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #484225

    frizzo
    Free User
    Post count: 7

    Hello,

    I’m trying to create a new place with the API. It isn’t working correctly. The place gets created, however, it’s missing the majority of fields.

    When I view the place in admin, it’s missing all fields I passed in other than the title.

    Request

    
    POST /wp-json/geodir/v2/places/?title=Test%20Place&street=123%20Fake%20St&country=United%20States&city=Rockford&region=IL&zip=61108&latitude=42.266800&longitude=-89.088379&post_category=51&email=test%40test.com HTTP/1.1
    Authorization: Basic ZGVubmlzQG1lbmdlbHQuY29tOmIwbWJhdDBt
    Content-Type: application/octet-stream
    Host: example.com
    Connection: close
    User-Agent: Paw/3.1.7 (Macintosh; OS X/10.14.2) GCDHTTPRequest
    Content-Length: 0
    

    Response

    
    HTTP/1.1 201 Created
    Server: nginx
    Date: Thu, 02 May 2019 20:58:38 GMT
    Content-Type: application/json; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: close
    X-Robots-Tag: noindex
    Link: <https://example.com/wp-json/>; rel="https://api.w.org/"
    X-Content-Type-Options: nosniff
    Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages
    Access-Control-Allow-Headers: Authorization, Content-Type
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Cache-Control: no-transform, no-cache, must-revalidate, max-age=0
    Allow: GET, POST
    Location: https://example.com/wp-json/geodir/v2/places/26031
    Host-Header: 192fc2e7e50945beb8231a492d6a8024
    alt-svc: quic=":443"; ma=86400; v="43,39"
    
    {"id":null,"title":{"raw":null,"rendered":"Test Place"},"slug":null,"link":"https:\/\/example.com\/?post_type=gd_place&p=26031","status":null,"type":null,"author":0,"date":false,"date_gmt":false,"modified":false,"modified_gmt":false,"content":{"raw":null,"rendered":"","protected":false},"default_category":null,"post_category":[{"id":51,"name":"Nursing Home","slug":"nursing-home"}],"post_tags":[],"package_id":null,"street":null,"country":null,"region":null,"city":null,"zip":null,"map":null,"latitude":null,"longitude":null,"mapview":null,"mapzoom":null,"claimed":{"raw":null,"rendered":"No"},"logo":null,"licensing_information":null,"phone":null,"website":null,"email":null,"video":null,"special_offers":null,"business_hours":null,"featured":false,"rating":0,"rating_count":0,"featured_media":0,"featured_image":[],"images":[],"meta":[],"guid":{"rendered":null,"raw":null},"_links":{"self":[{"href":"https:\/\/example.com\/wp-json\/geodir\/v2\/places\/26031"}],"collection":[{"href":"https:\/\/example.com\/wp-json\/geodir\/v2\/places"}],"about":[{"href":"https:\/\/example.com\/wp-json\/geodir\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/example.com\/wp-json\/wp\/v2\/users\/3"}],"version-history":[{"href":"https:\/\/example.com\/wp-json\/geodir\/v2\/places\/26031\/revisions"}],"wp:attachment":[{"href":"https:\/\/example.com\/wp-json\/wp\/v2\/media?parent=26031"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/example.com\/wp-json\/geodir\/v2\/places\/tags?post=26031"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/example.com\/wp-json\/geodir\/v2\/places\/categories?post=26031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
    

    I’ve replaced the domain name with ‘example.com’ in the request/response above.

    #484296

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    I have flagged your topic for the developers.

    For your reference: https://wpgeodirectory.com/docs-v2/geodirectory/settings/api/

    #484300

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #484344

    frizzo
    Free User
    Post count: 7
    This reply has been marked as private.
    #484734

    frizzo
    Free User
    Post count: 7
    This reply has been marked as private.
    #484779

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #484808

    frizzo
    Free User
    Post count: 7
    This reply has been marked as private.
    #484892

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #484975

    frizzo
    Free User
    Post count: 7
    This reply has been marked as private.
    #485566

    Kiran
    Moderator
    Post count: 7069

    Hello,

    The “REST API Console” is a 3rd party tool provided by “WP REST API Team” to test WordPress REST API requests through your normal WordPress admin.

    Did you try this tool to submit API request with same fields & data?

    Is it possible to check and test API request from my side? If yes, then provide details so i can check what going wrong.

    Regards,
    Kiran

    #485691

    frizzo
    Free User
    Post count: 7
    This reply has been marked as private.
    #486328

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
Viewing 12 posts - 1 through 12 (of 12 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket