LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Do I need a curl library?
How much do I need to learn in order to use cUrl? (I am fine with json)
How come there is so little interest in the LC community on the ability to post Calendar data (sigh)? I know the sync is tough, but to be able to create a calendar event from a LC standalone on desktop and mobile, should be something appealing. Or not?
--headers
put quote & "Authorization: Bearer YOURTOKEN" & quote & CRLF into tHeaders
set the httpHeaders to tHeaders
PUT URL "https://api.cronofy.com/v1/calendars"
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
on mouseUp pButtonNumber
--clean up
put empty into fld "TheError"
put empty into fld "TheResult"
--headers
put quote & "Authorization: Bearer" && fld "TheToken" & quote into tHeaders
--put quote & "Authorization: Bearer" && fld "TheToken" & quote & CRLF into tHeaders
set the httpHeaders to tHeaders
get URL "https://api.cronofy.com/v1/calendars"
--put URL "https://api.cronofy.com/v1/calendars" into fld "TheResult" of this card
put it into fld "TheResult" of this card
put the result into fld "TheError" of this card
end mouseUp
A 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn't follow the rules.
Probably you need to know what way your server want the data or the header.
You can use the libURLSetCustomHTTPHeaders command to create a perfect header compliant to the server, there are also a lot of libURL...
While Applescript does not work on iOS, I wonder if someone can arrange something with the Javascript, in order to give basic functionality to a Mobile standalone for adding, modifying and deleting events on the system calendar.
At Livecode there is a lot of talk about Widgets and Builder: Calendar and Contact interaction are the kind of functionalities that developer need, in my opinion.
Last edited by trevix on Sun Aug 12, 2018 11:11 am, edited 1 time in total.
While waiting for answer from some expert, I tried another approach: using SQLite to read the Calendar Cache file on OSX.
I uploaded on LC Sample Stack a "lib_OSXCal" stack that does this: read calendar events from the Calendar Cache file, using SQLite.
I don't even know if this is correct or it messes up the calendar file (I guess reading is ok, while writing could be a problem).
The OSX "Calendar.app" also uses the "Write-Ahead Logging".
When you open Calendar.app you can sometimes see "Calendar Cache-wal" and "Calendar Cache-shm" files under the same path of the "Calendar Cache". I am having hard time finding on the web how these files work (you can't open them with a SQLite browser) , if they can mess out the SQLlite reading/writing or, for what I know, screw completely the Calendar.app database.
I would appreciate some comments or SQL improvement (I am a NOB on this).