[DOCU-1855] Tip for commands endpoint usage: parameters of type Date must be supplied in "millis/long" format Created: 14/Feb/19  Updated: 10/Sep/20  Resolved: 30/Jul/19

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Richard Gange
Resolution: Done Votes: 0
Labels: quickwin
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File scheduled-example.png    
Issue Links:
relation

 Description   

It is not obvious or intuitive how to properly supply the value for a command parameter that expects a Date type.

Include a tip on this page (and 5.7, 6.1) on how to do it: https://documentation.magnolia-cms.com/display/DOCS60/Commands+endpoint+API

Suggestion, in the "body" parameter description, include the following:

Request body in JSON or XML format; it contains the parameters required to execute the command.

For commands with parameters of type Date, supply the value as a long integer with no quotes. (The number of milliseconds since 1970-01-01)

 



 Comments   
Comment by Richard Gange [ 30/Jul/19 ]

czimmermann and cc awarinner

I was working on this ticket. I wanted to do a publication example and a scheduled publication example.
https://documentation.magnolia-cms.com/display/DOCS61/Commands+endpoint+API
I found that sending an int (or long) did not work. Instead I needed to send a string. Like this:

curl http://localhost:8080/magnoliaAuthor/.rest/commands/v2/website/activate \
  -H "Content-Type: application/json" \
  -X POST --user superuser:superuser \
  --data \
'{
  "comment": "Published via REST (scheduled)",
  "publicationDate": "2020-01-01T11:10:00.000+01:00",
  "repository": "website",
  "path": "/travel/hello",
  "recursive": false
}'

Sending the date as a string in the proper format also created a date property in the JCR.

Do either of you know in what scenario I need to use milliseconds since 1/1/1970? Maybe I need to add another example to the page.

Comment by Richard Gange [ 30/Jul/19 ]

Done 5.7, 6.0, 6.1. Added an example for scheduled publication which shows how to send a date.

Generated at Mon Feb 12 01:21:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.