Various Errors with creating calendar entries - clio-api

I'm struggling to be able to create calendar entries on particular calendars. I get a variety of errors, most often 404, but also 500 errors. I'm following the Clio API v.4 documentation, which I notice doesn't provide a way to specify which calendar to create an entry on, though it does allow you to specify the calendar owner, which might be the solution except users might have multiple calendars.
I'm sending POSTS to https://app.clio.com/api/v4/calendar_entries.json
Here's the JSON I'm sending in the POST:
{"data":{
"summary":"string",
"matter":{"id":integer},
"start_at":"ISO 8601 Date",
"end_at":"ISO 8601 Date",
"desription":"string"
}}
This returns a (500) "InternalServiceError."
If I modify it to specify a calendar owner I get a (404) "NotFoundError", Like so:
{"data":{
"summary":"string",
"matter":{"id":integer},
"start_at":"ISO 8601 Date",
"end_at":"ISO 8601 Date",
"calendar_owner":{"id":integer},
"desription":"string"
}}
I've played around with alternative formulations with no luck. In "calendar_owner":{"id":x} I've exchanged the owner's user id with the calendar_id, to no avail. I've added a key/value pair for calendar_id:integer, with no luck. I've also modified the URI for the post to https://app.clio.com/api/v4/calendar_entries/x.json where x is the calendar_id.
I don't think I'm missing anything that's in the documentation, but I'm definitely missing something. The token I'm using has the appropriate scope and is for a user with either owner or editor permission on the calendar.
Any fixes here?

Related

Difference between Created and Created. in SharePoint REST API Call

I call SPO Rest API and in response I found two type of dates. I am not able to find any documentation on their difference especially the one with Dot (.)
Both Dates are shown here
We want to use one with Dot as its in standard format, but not sure about its authenticity. We are using RenderListDataAsStream as end point to get data.
Any documentation of properties coming with Dot(.) will be helpful to understand it. In attached image count is also another same example having dot.
P.S: here are the differnt ways to access them
I think the value of the normal named key (like technical field name) represents the value shown in UI to a user. So it is affected by the regional settings of the web.
The value of the additional "."-key (technical field name plus ".") represents the UTC-0 value in ISO format (like the data is stored in DB internaly).
For example:
"Created": "0;#2022-09-07 06:17:37", // timestamp by Regional Settings
"Created.": "2022-09-07T13:17:37Z", // UTC-0 in ISO format

Instagram Search for a tag within particular date range

I am looking to retrieve results from instagram for a particular tag mytag , I tried using this API call,
https://api.instagram.com/v1/tags/{tag-name}/media/recent
but it only returned 33 results even though there are more results. This question can be considered an extension to this question: How To Search Instagram via API Query?
What is the way to return instagram results for a particular tag within a date range?
This may be done through the min_tag_id and max_tag_id which. Not sure how to convert my date time to min_tag_id or max_tag_id?
call the API with max_tag_id and min_tag_id like this:
https://api.instagram.com/v1/tags/{tag-name}/media/recent?client_id={CLIENT_ID}&max_tag_id=1378677250000000&min_tag_id=1375998850000000
max_tag_id and min_tag_id is epoch_time + "000000"
you still only get 20 per API call, use pagination to get all
Update: Instagram changed the tag_id, so date filter cannot be done
this way. Login on http://gramfeed.com and search for a hashtag and
you can do date/time filter, its a different hack implementation.

Rational ClearQuest Http request to find defects that have been updated since a specific time?

I am trying to use ClearQuest OSLC CM REST API to write an http request to accomplish the following. I want to get a list (in the XML format) of ClearQuest defects that have been updated since a specified time.
So far I have been able to get a list of all defects from a particular defect family that I'm interested in with the following request (I'm using a sample base URL here):
http://localhost:8080/oslc/cqrest/repo/7.0.0/db/SAMPL/record/?oslc_cm.query=Found_in_Product_Family="MyDefectFamily"&rcm.type=Defect
I also was able to put together an http request that returned a complete timestamp history for a single defect like so:
http://localhost:8080/oslc/cqrest/repo/7.0.0/db/SAMPL/record/16777241-38577895?oslc_cm.properties=id,dbid,history{action_timestamp}
I can show sample xml response for both of those requests if anyone thinks it can be helpful here.
I can't seem to figure out how to write a request that will return a list of defects (id, dbid, timestamp) that contain a timestamp later than say 01/01/2014 00:00:00. Or at least a request that would return all defects where each defect entry would contain the last timestamp in it's history. I think I can get a list of all defects with all timestamps for each defect but I would like just the last timestamp. Taking the last node in the timestamp history doesn't work. Timestamp history doesn't seem to be ordered. Some sort of max function seems to be necessary for such a request.
Can anyone point me in the right direction or tell if what I want is impossible with ClearQuest OSLC CM REST API?
This is what I use in VB.NET:
Dim asOfValue = asOf.ToString("'""'yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z""^^xsd:dateTime'")
Dim upToValue = upTo.ToString("'""'yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z""^^xsd:dateTime'")
Dim where = "cq:history{cq:action_timestamp>=" & asOfValue & " and cq:action_timestamp<=" & upToValue & "}"
Const prefix = "cq=<http://www.ibm.com/xmlns/prod/rational/clearquest/1.0/>"
uri.Query = String.Format("oslc.orderBy=dcterms:identifier&oslc.where={0}&oslc.select={1}&oslc.prefix={2}", where, select, prefix)

Proper REST formatted URL with date ranges

I have a REST URL to get all users formatted like this:
http://example.com/users
To get an individual user by id:
http://example.com/users/12345
To get all user's bids:
http://example.com/users/12345/bids
To get all user's bids between two dates:
http://example.com/users/12345/bids/?start=01/01/2012&end=01/31/2012
or should it be like this:
http://example.com/users/12345/bids/start/01012012/end/01312012
I'm leaning towards the 1st date range URL as start and end are not entities in the domain. What is the proper way to format a REST URL with a date range?
Thanks,
Tom
http://example.com/users/12345/bids?start=01-01-2012&end=01-31-2012
Have the query parameters on the same "level" as the bids (remove the slash before the question mark). But you would probably want to have support for if they only provide one query parameter. So if they only provided "start" then it would get all bids after that date, or if they only provided "end" it would get all bids before that date.
The reasoning being that query parameters are good for GETting a subset of results from a GET request. They don't go on another level because the next level is usually one specific item with a unique identifier.
I would go with http://example.com/users/12345/bids?start=2012-01-01&end=2012-01-31.
There shouldn't be a slash before the query string.
Avoid using slashes in the query string. It'll be easier that way.
If you use the path separator / to delimit the values you're likely to encounter numerous issues. If you decide you want the start and end dates to allow ISO formats e.g. 2021-10-12T01:00:00.000Z, 2021-10-01T18:00:00.000+05:00, those formats contain characters that will break the URL. Much better to use querystring parameters.
I'd recommend using the querystring and ISO format for dates so your URL will look something like this:
https://example.com/users/12345/bids?start=2022-08-08T00:00:00.000Z&end=2022-08-09T00:00:00.000Z
Your API method that retrieves by date range can then be differentiated from the GET request that retrieves all bids for the user, simply by using a different method signature that expects additional start and end date parameters in the request.
if example.com/users/12345 gets the user with id 12345, then to get all users by id it should be example.com/users with the id included in the response as a relationship. (usually a hyperlink to that resource).
Now to get them by date ranges it should be example.com/users/start=01-01-2012&end=01-31-2012
The 12345 part is the id of an individual user, it's a resource, therefore it should not be included to get the rest of the users.
As the name of the parameter it should be meaningful. start could mean anything, but start_date is more meaninful.

"sex" field in Users.getInfo in Facebook API

This is a noob question. According to Facebook API documentation, the sex field in Users.getInfo() function returns values based on users' locale. Hence, determine the gender of user is difficult.
Any solution suggested?
1) This isn't an elegant solution, and perhaps there's a better way that uses the API, but what if you manually created a look-up table for different values of 'sex' in different locales? You could try checking out facebook profiles of people from different countries and get the string displayed for their sex. Then, put that into some kind of dictionary data structure that allows you to grab the M-F string pair based on the locale's code (also given by getInfo()). For example en-US => (male, female), ja-JP => (男性, 女性). Of course, you could try using google translate too. After you gathered this data for a handful of the main locales, you'd be more-or-less covered. Maybe someone on the internets already has done it.
Of course, you could try emailing someone who works on the API for these values. The list of locale codes is here http://wiki.developers.facebook.com/index.php/Facebook_Locales .
2) Here is probably a better solution than (1). If you directly query the FQL User table, the value returned in 'sex' will always be English, starting from February 7 2010. More information about that is here: http://wiki.developers.facebook.com/index.php/User_%28FQL%29 . So, perhaps in the future getInfo() will return only English too. Who knows.
3) The answer to your question is also given on this existing post: Facebook FQL user table `sex` field : how to return male/female even the user is using different locale?