Title: REST API. POST request
Last modified: April 21, 2021

---

# REST API. POST request

 *  Resolved [primserion](https://wordpress.org/support/users/primserion/)
 * (@primserion)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/rest-api-post-request/)
 * REST API text_datetime_timestamp field format in the post request. I try “expires”:{“
   date”: “04/06/2021”} and “expires”: “1619006768”

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

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [5 years, 1 month ago](https://wordpress.org/support/topic/rest-api-post-request/#post-14347310)
 * I’m assuming you’re trying to update the meta value in a POST request but it’s
   failing in some way? Is that correct? or am I not quite accurate here?
 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/rest-api-post-request/#post-14352415)
 * I’ve pushed some updates to the develop branch and will be in the next release
   which make the values passed to these fields via the REST API a little more flexible(
   e.g. it will take timestamps and formatted date values), but for now, you’ll 
   have to format the data the way the field expects it.
 * In the case of the `text_datetime_timestamp` field type, you need to give it 
   an array with date and time values:
 *     ```
       curl --request POST \
         --url '<REST_URL>/cmb2/v1/boxes/<BOX_ID>/fields/<FIELD_ID>?object_id=<POST_ID>&object_type=post&value%5Bdate%5D=2021-04-09&value%5Btime%5D=13%3A45'
       ```
   
 * Or you can include the value in the BODY of the request as JSON:
 *     ```
       curl --request POST \
         --url '<REST_URL>/cmb2/v1/boxes/<BOX_ID>/fields/<FIELD_ID>?object_id=<POST_ID>&object_type=post' \
         --header 'Content-Type: application/json' \
         --data '{"value":{"date":"2021-04-09","time":"19:45"}}'
       ```
   
 * I hope that makes sense.

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

The topic ‘REST API. POST request’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [format](https://wordpress.org/support/topic-tag/format/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [rest](https://wordpress.org/support/topic-tag/rest/)

 * 2 replies
 * 3 participants
 * Last reply from: [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/rest-api-post-request/#post-14352415)
 * Status: resolved