Jump to content

rest api post request date


Recommended Posts

Hello. The api documentation says that for creating a database record we can pass the date as datetime.

When I try to pass the date formatted like this 2024-08-18T19:19:06Z it does not seem to work and the record shows the current date.

Every other field, aspect of rest api works fine. Am I doing something wrong? Thanks.

Link to comment
Share on other sites

On 8/19/2024 at 8:08 AM, teraßyte said:

That should be a valid format. 🤔

 

Maybe try only with the date to see if that works first?

2024-08-18

Thank you. This would not be an ideal solution for me, but even this did not work.

Does anyone else have this issue? Any solutions. 

Link to comment
Share on other sites

  • 3 weeks later...

Thank you @Daniel F. That part of the code looks like this:

 

			$date_tmp = new DateTime();
			$date_tmp->modify('-24 hours');			

			//$formattedDate = $date_tmp->format('Y-m-d\TH:i:s\Z');			
			$formattedDate = $date_tmp->format('Y-m-d');
	
			$data2 = array(
			"status" => "published",
			"category" => $cat_id,
			"author" => $author,
			"fields" => $fields2,
			"image" => $zzz_image,
			"date" => $formattedDate,
			"hidden" => 1, 
			);

		$curl2 = curl_init( $communityUrl . 'cms/records/7' );

You will notice there are 2 formattedDate variations, one is commented out. Neither one worked for me.

Edited by virap1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...