Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter techlearner851

    (@techlearner851)

    Hi Darian I haven’t received a response/resolution to this so not sure why this is marked as resolved

    Thread Starter techlearner851

    (@techlearner851)

    Hi @d0153 /@tristan083, as I’ve said before, my client would like to move forward with the purchase of this plugin along with add-ons pending a resolution to this ticket. Your attention to this is greatly appreciated. Thanks!

    Thread Starter techlearner851

    (@techlearner851)

    It may be helpful if you could send me sample curl requests for creating and updating an event. That way I would be able to see what I may be doing wrong on my end. Thanks!

    Thread Starter techlearner851

    (@techlearner851)

    Hi @tristan083, I tried POST with the following curl but received a 404 not found even though event id 17246 exists:

     curl --request POST \
      --url https://mydomain/wp-json/tribe/events/v1/events/17246 \
      --header 'Authorization: Basic V1VGVzo2azhEIFNORUogYWRwdyAzTzdnIGNtWXIgsdfdfdfd==' \
      --header 'Content-Type: application/x-www-form-urlencoded' \
      --data author=10 \
      --data 'date=2023-02-10 02:13:07' \
      --data 'date_utc=2023-02-10 02:13:07' \
      --data 'title=TEST EVENT' \
      --data 'description=<p>test event updated</p>' \
      --data slug=test-event \
      --data 'excerpt=<p>test event</p>' \
      --data status=publish \
      --data 'timezone=UTC+0' \
      --data all_day=false \
      --data 'start_date=2023-02-11 19:30:00' \
      --data 'end_date=2023-02-11 21:30:00' \
      --data image= \
      --data cost=0 \
      --data website= \
      --data show_map=false \
      --data show_map_link=false \
      --data hide_from_listings=false \
      --data sticky=false \
      --data featured=false \
      --data 'categories=[]' \
      --data 'tags=[]' \
      --data 'venue=[]' \
      --data 'organizer=[]'

    It may be helpful if you could send me sample curl requests for creating and updating an event. That way I would be able to see what I may be doing wrong on my end. Thanks!

    Thread Starter techlearner851

    (@techlearner851)

    Hi @tristan083, in taking a closer look at the Swagger for the Events Calendar API, it looks like I need to pass in the POST payload as application/x-www-form-urlencoded and not JSON. I will try this and let you know but was wondering if you have plans to allow JSON payloads in a future release as it is yet another step for developers to convert JSON to form params. Thanks in advance for your assistance.

    Thread Starter techlearner851

    (@techlearner851)

    Hi @tristan083,

    Thank you for responding. I tried your suggestion above and while it returned a 200 OK response, the description field was not updated with the new value:

    ...
    "description": "<p>test event updated<\/p>",
    ...

    It just returned 200 OK and the description was the original:

    ...
    "description": "<p>test event<\/p>",
    ...
    Thread Starter techlearner851

    (@techlearner851)

    • PHP: 7.4.33.1
    • WordPress: 6.1.1
    • The Events Calendar: 6.0.8
    • Theme: Divi 4.19.5
    Thread Starter techlearner851

    (@techlearner851)

    To create the test event I did a POST to https://mydomain/wp-json/tribe/events/v1/events

    {
    	"author": "10",
    	"status": "publish",
    	"date": "2023-02-01 02:13:07",
    	"date_utc": "2023-01-31 02:13:07",
    	"modified": "2023-01-31 02:13:07",
    	"modified_utc": "2023-01-31 02:13:07",
    	"title": "MY TEST EVENT",
    	"description": "my test event",
    	"excerpt": "my test event",
    	"slug": "my-test-event",
    	"all_day": false,
    	"start_date": "2023-02-01 19:30:00",
    	"start_date_details": {
    		"year": "2023",
    		"month": "02",
    		"day": "01",
    		"hour": "19",
    		"minutes": "30",
    		"seconds": "00"
    	},
    	"end_date": "2023-02-01 21:30:00",
    	"end_date_details": {
    		"year": "2023",
    		"month": "02",
    		"day": "01",
    		"hour": "21",
    		"minutes": "30",
    		"seconds": "00"
    	},
    	"utc_start_date": "2023-02-01 19:30:00",
    	"utc_start_date_details": {
    		"year": "2023",
    		"month": "02",
    		"day": "01",
    		"hour": "19",
    		"minutes": "30",
    		"seconds": "00"
    	},
    	"utc_end_date": "2023-02-01 21:30:00",
    	"utc_end_date_details": {
    		"year": "2023",
    		"month": "02",
    		"day": "01",
    		"hour": "21",
    		"minutes": "30",
    		"seconds": "00"
    	},
    	"timezone": "UTC+0",
    	"timezone_abbr": "UTC+0",
    	"cost": "",
    	"cost_details": {
    		"currency_symbol": "",
    		"currency_code": "",
    		"currency_position": "prefix",
    		"values": []
    	},
    	"website": "",
    	"show_map": false,
    	"show_map_link": false,
    	"hide_from_listings": false,
    	"sticky": false,
    	"featured": false,
    	"categories": [],
    	"tags": [],
    	"venue": [],
    	"organizer": []
    }

    The API responded with 201 (created).

    I then wanted to modify the event’s description so sent a PUT request with following payload (which is a copy/paste of the response from the previous POST with an updated description):

    {
    	"id": 17188,
    	"global_id": "mydomain.com?id=17188",
    	"global_id_lineage": [
    		"mydomain.com?id=17188"
    	],
    	"author": "10",
    	"status": "publish",
    	"date": "2023-02-01 02:13:07",
    	"date_utc": "2023-01-31 02:13:07",
    	"modified": "2023-02-01 02:13:07",
    	"modified_utc": "2023-01-31 02:13:07",
    	"url": "https:\/\/mydomain.com\/event\/my-test-event\/",
    	"rest_url": "https:\/\/mydomain.com\/wp-json\/tribe\/events\/v1\/events\/17188",
    	"title": "MY TEST EVENT",
    	"description": "<p>my test event updated<\/p>",
    	"excerpt": "<p>my test event<\/p>",
    	"slug": "my-test-event",
    	"all_day": false,
    	"start_date": "2023-02-01 19:30:00",
    	"start_date_details": {
    		"year": "2023",
    		"month": "02",
    		"day": "01",
    		"hour": "19",
    		"minutes": "30",
    		"seconds": "00"
    	},
    	"end_date": "2023-02-01 21:30:00",
    	"end_date_details": {
    		"year": "2023",
    		"month": "02",
    		"day": "01",
    		"hour": "21",
    		"minutes": "30",
    		"seconds": "00"
    	},
    	"utc_start_date": "2023-02-01 19:30:00",
    	"utc_start_date_details": {
    		"year": "2023",
    		"month": "02",
    		"day": "01",
    		"hour": "19",
    		"minutes": "30",
    		"seconds": "00"
    	},
    	"utc_end_date": "2023-02-01 21:30:00",
    	"utc_end_date_details": {
    		"year": "2023",
    		"month": "02",
    		"day": "01",
    		"hour": "21",
    		"minutes": "30",
    		"seconds": "00"
    	},
    	"timezone": "UTC+0",
    	"timezone_abbr": "UTC+0",
    	"cost": "",
    	"cost_details": {
    		"currency_symbol": "",
    		"currency_code": "",
    		"currency_position": "",
    		"values": []
    	},
    	"website": "https:\/\/mydomain.com\/event\/my-test-event\/",
    	"show_map": false,
    	"show_map_link": false,
    	"hide_from_listings": false,
    	"sticky": false,
    	"featured": false,
    	"categories": [],
    	"tags": [],
    	"venue": [],
    	"organizer": []
    }

    The response was:

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

    So I changed the PUT to a POST and resubmitted. This ended up creating a new event as the API responded with a 201 and I see two events in my event list.

Viewing 8 replies - 1 through 8 (of 8 total)