API + curl: Update Site Created Date

Many thanks to @kgoetz for posting some API examples with curl a while back. Using the Update one and reading the developer manual, I’ve had mixed success.

Specifically, I want to see if I can update a Site’s created data. (To force a particular sort in the listing of Sites, if that matters.) But despite the doco saying, “The payload completely updates/replaces the existing resource with the given ID,” I can’t get created to change. Should I be able to, or is this the exception to what the JSON updates? (Are there other exceptions?)

Yes, there are aspects of the JSON output that are “read only” so to speak, and both the created and updated dates are among them. It’s not a particularly extensive list: also “unsettable” would be the properties for the ID of the resource itself.

The reference to “complete replace” in the documentation is merely that everything that can be set, is set when doing a PUT: in particular omitting parts of the JSON will generally cause those things to be unset or deleted from the resource.

1 Like

OK – just to spell it out for me when I forget the answer and have to come back here, there’s no way edit created date other than direct db access, and there’s therefore no way to force a sort on the site listing other than meddling with titles?

That’s correct.

A module could allow to you edit the dates associated with resources, including sites, either through the UI or the API, but the core does not include such functionality.