How can I fix a 501 error from the clockify API? - clockify

I'm getting a 501 response from the clockify API when trying to create a Time Entry using CreateTimeEntryRequest
I've verified I can query the API and get data from it, so I'm using the correct X-Api-Key, I've resolved a few issues with bad datetime formats, but I'm still getting the error.
URL I'm posting to:
https://api.clockify.me/api/workspaces/REMOVED/timeEntries/
My POST request header looks like this:
{"x-api-key": REMOVED, "Content-Type": "application/json"}
The body of the request is (For example):
{"start": "2019-01-28T14:53:04Z", "billable": false, "description": "Test Time Entry", "projectID": null, "taskID": null, "end": "2019-01-28T15:53:04Z", "tagIds": []}
I'm getting:
{"message": "Entity not created.", "code": 501}
And the time entry is not being created.
I expect some kind of success message

It has something to do with the "End" variable. If you remove it, it'll work. This of course means the timer will be running (also you will get a 400 error if you already have a timer running), so if you want to stop it, you'll have to immediately call PUT /workspaces/{workspaceId}/timeEntries/endStarted or if you want the stop time to be at some point in the past, you'll have to update the timer with PUT /workspaces/{workspaceId}/timeEntries/{id}. However the update doesn't seem to work either (same issue). My guess is they made a change to the endpoint (perhaps renamed the "end" variable), because I'm about 75% sure I used this API within the last month or so and it worked.
Hopefully someone from Clockify will see this and give an update. I had a similar issue happen with the "me" field in the GetSummaryReportRequest object. It stopped working and removing the field fixed it.

Related

Are fullPageUrl and averageSessionDuration no longer compatible in Reporting API?

Until December 12th 2022, I was able to combine fullPageUrl and averageSessionDuration in run report requests to the
Following endpoint
https://analyticsdata.googleapis.com/v1beta/properties/xxxxxxxxxx:runReport
If you go dimensions and metrics exporer and select the dimension "fullPageUrl", you can no longer select "averageSessionDuration". They are incompatible now.
My request body in JSON looks like this:
{"dimensions":[{"name":"date"},{"name":"fullPageUrl"},
{"name":"pageTitle"},],"metrics":[{"name":"averageSessionDuration"},{"name":"userEngagementDuration"},],"dateRanges":[{"startDate":"7daysAgo","endDate":"today"}]}
I get this error message as a reply:
{
"error": {
"code": 400,
"message": "Please remove averageSessionDuration to make the request compatible. The request's dimensions & metrics are incompatible. To learn more, see https://ga-dev-tools.web.app/ga4/dimensions-metrics-explorer/",
"status": "INVALID_ARGUMENT"
}
}
I couldnt find anything in the documentation or in the changelogs.
The Google analytics data api is in beta it is not completed which means that they are still tuning it.
Your issue is that "fullPageUrl" and "averageSessionDuration" are not longer compatible you cant use them together in a report.
That being said I cant find any mention of it in the change log so I am going to contact the team and see what they have to say.

Form Recognizer not processing requests

For the past few hours form recognizer analyze
https://my_ResourceName.cognitiveservices.azure.com/formrecognizer/v2.0-preview/custom/models/my_modelId/analyzeresults/my_referenceId
{
"status": "notStarted",
"createdDateTime": "2021-06-14T21:00:38Z",
"lastUpdatedDateTime": "2021-06-14T21:00:39Z"
}
Anyone has similar experience? I know usually takes some time to process form but now all tries to process form are failing with no error of any sort. Using postman to check both post to analyze and get analyze results. This used to work for months without issues until today!
Form recognizer has new version!
https://my_ResourceName.cognitiveservices.azure.com/formrecognizer/v2.1-preview.3/custom/models/my_modelId/analyzeresults/my_referenceId
It would be nice if old webservice was returning more descriptive message instead of "notStarted", since it will never start again in the future, and point users to new url.

Search for campaign groups using LinkedIn Ads API always return 400 Bad Request

Using LinkedIn Ads API document on this page -> https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-campaign-groups#search-for-campaign-groups
If I search for campaign groups with completed status, it will always return 400 Bad Request with following message
{
"message": "{field=ID, order=ASCENDING} does not provide a valid value for sort.field for CampaignGroupSort. The acceptable values for field: ID,ACCOUNT,NAME",
"status": 400
}
As you can see from the message itself, I've already used ID as sort's field. Following is a request url that causing error
https://api.linkedin.com/v2/adCampaignGroupsV2?q=search&sort.field=ID&sort.order=ASCENDING&search.status.values[0]=COMPLETED
However, this issue doesn't happened if I just changed search.status.values from COMPLETED to something else e.g. ACTIVE. Like the following request
https://api.linkedin.com/v2/adCampaignGroupsV2?q=search&sort.field=ID&sort.order=ASCENDING&search.status.values[0]=ACTIVE
Above request returns with http status 200 with success result.
I've tried many combinations with no luck. Anyone can help please?
https://api.linkedin.com/v2/adCampaignGroupsV2?q=search&sort.field=ID&sort.order=ASCENDING&search.status.values[0]=COMPLETD
There is a typo in COMPLETED for your search.status.values[0].

Clockify API - Restart time entry

I would like to mark the last time entry for a user as the current time entry. In other words, I would like to clear the end field of a given time entry, to indicate that it it not finished yet, it's still running.
Is it possible to do that?
I tried using the Update time entry on workspace endpoint, like so:
curl -H 'Content-Type':'application/json' \
-H 'X-Api-Key':'API_KEY' \
-X PUT https://api.clockify.me/api/workspaces/WORKSPACE_ID/timeEntries/TIME_ENTRY_ID \
-d '{"end":null}'
But the response code is 400 with the following response:
{"message":"text","code":3002}
What does this error code mean?
So the documentation for the UpdateTimeEntryRequest (https://clockify.github.io/clockify_api_docs/#/definitions/UpdateTimeEntryRequest) is a bit wrong or incomplete. I figured it out through some testing, here's what you need to do:
First, you need to make sure you have the current data of the time entry, specifically the start date and billable status (as these are the only two "required" fields in the API call). You are getting the 400 bad request because you are missing these two fields - the error message is obviously no help here, but a 400 response code means "the server was unable to process the request sent by the client due to invalid syntax.", which makes sense, since your input is invalid.
Assuming you have the time entry information already (which is the only way I could see how you would know the ID), you could recreate the whole UpdateTimeEntryRequest data but then null out the end field or leave it out completely, like this:
{
"start": START_FROM_THE_TIME_ENTRY,
"billable": BILLABLE_FROM_THE_TIME_ENTRY,
"description": DESC_FROM_THE_TIME_ENTRY,
"projectId": PROJECT_ID,
"taskId": TASK_ID,
"end": null,
"tagIds": TAGS_ARRAY
}
From my testing, this restarts the timer. If you leave out any field, those fields are reset, for example:
{
"start": START_FROM_THE_TIME_ENTRY,
"billable": BILLABLE_FROM_THE_TIME_ENTRY
}
would restart the timer, but it would clear the description, project/task, and tags, which is probably not preferable.

How to give empty value for argument in POST request for hyperledger composer rest server

I am trying to make a post request via R using the httr package to composer rest server. I have written a code and then created the composer rest server from it. These are my details
Request URL : http://localhost:3000/api/nl.amis.registry.fruits
Body: {
"$class": "nl.amis.registry.fruits",
"Id": "9",
"name": "orange",
"description": "string",
"count": ""
}
First, I have tried with the composer rest server. For my purpose, I needed the count to be blank and the value will be appended by another API call. I was able to make the transaction successfully with the count: "". This I was able to check in the test section of the composer playground. The remaining code works fine which appends the count variable later on.
Now I am writing an R code to make a similar transaction through POST request. Here I am facing an error that "count cannot be blank" and returns with error 422 Unprocessable entity. The content type I was used was application/json. While using the "count":{} , the post request process fine and i am getting "count":[object Object] in the response. But the later on code which does the appending will do something like count:"[object Object],1" wherein I am expecting "count":"1". Everything works fine while using the test in composer playground but while trying to access externally via rest API is creating the problem. Please help.
you can use an Optional keyword to declare a count in an asset of the model file. using Optional keyword you can post an empty value of count.
for example:
asset fruits identified by Id {
o String Id
o String name
o String description
o String count optional
}

Resources