How can I publish a Simperium note? - simperium

How can I publish a note using the PublishURL propertie?
{"tags": [], "deleted": false, "shareURL": "", "systemTags": [], "content": "updated note with new modification time", "publishURL": "", "modificationDate": 1341563318.0, "creationDate": 1335390338.091453}

The publish functionality still uses the old API currently - you can use the following call to publish a note
GET https://simple-note.appspot.com/api2/data/[note key]/publish
The response should contain a publishkey:
{ "publishkey" : "xdAa5s" }
You can use a X-Simperium-Token header like in Simperium to authenticate.

Related

Bitbucket API: Add default reviewers using usernames

On-prem server Bitbucket 6.10.
Referring to the API for adding default reviewers for a project.
POST Request:
https://git.company.net/rest/default-reviewers/1.0/projects/test-project/condition
Body:
{"sourceMatcher":{"id":"any","type":{"id":"ANY_REF"}}, "targetMatcher":{"id":"any","type":{"id":"ANY_REF"}}, "reviewers":[{"name": "p950a", "slug": "p950a", "id": 56111},{"name": "p950h", "slug": "p950h", "id": 45222}], "requiredApprovals":"0"}
It seems it's mandatory to pass "id" for each reviewer - "slug", "name" don't seem to work. I get the following error if "id" is excluded.
{
"errors": [
{
"context": null,
"message": "No user exists for identifier -1.",
"exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException"
}
]
}
It's quite inefficient and tedious to retrieve IDs for several users, store them and then again iterate over that list to pass here. Is there a better way to do this or am I missing something?

TFS 2017 Build Templates Property needs attention

I'm currently trying to create default build templates on Microsoft Team Foundation Server 2017.
I created a template via the REST API and it's going well overall.
But... One Question.
If anybody creates a build with my template, I wanna show him which settings he have to set up to run the build well. Until now I've done this:
The JSON looks like this:
...,
{
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "NuGet Packager ",
"timeoutInMinutes": 0,
"task": {
"id": "333b11bd-d341-40d9-afcf-b32d5ce6f24b",
"versionSpec": "0.*",
"definitionType": "task"
},
"inputs": {
"searchPattern": "<chooseProject>",
"outputdir": "",
"includeReferencedProjects": "false",
"versionByBuild": "false",
"versionEnvVar": "",
"requestedMajorVersion": "1",
"requestedMinorVersion": "0",
"requestedPatchVersion": "0",
"configurationToPack": "$(BuildConfiguration)",
"buildProperties": "",
"nuGetAdditionalArgs": "",
"nuGetPath": ""
}
}...
How can I change the json to make it look like this?
Just need to add a "required": true, in the inputs.
You could also refer the source code of this task in github--PublishBuildArtifacts

Create Plan (BETA) doesn't seem to work

I'm trying to create a planner plan using Graph as per http://graph.microsoft.io/en-us/docs/api-reference/beta/api/user_post_plans
but I'm consistently getting the following BadRequest response:
"error": {
"code": "BadRequest",
"message": "Write requests are only supported on contained entities",
"innerError": {
"request-id": "eae08944-6f47-477e-9950-ade31c473dd7",
"date": "2016-03-07T11:59:04"
}
As per the docs I'm POSTing to https://graph.microsoft.com/beta/me/plans with the following body:
"createdBy": "<my uuid>",
"owner": "<a previously generated group uuid>",
"title": "Blah Plan"
with no luck. The previously generated group looks like the following:
{
"id": "<uuid>",
"classification": null,
"createdDateTime": "2016-03-07T09:53:26Z",
"description": "Int Test",
"displayName": "Int Test",
"groupTypes": [
"Unified"
],
"mail": "<email_address>",
"mailEnabled": true,
"mailNickname": "IntTest",
"onPremisesLastSyncDateTime": null,
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"proxyAddresses": [
"SMTP:<email_address>"
],
"renewedDateTime": "2016-03-07T09:53:26Z",
"securityEnabled": false,
"visibility": "Public"
}
I've tried various combinations of request bodies. With and without createdBy values. With and without owner values. Nothing seems to work.
Any ideas where I'm going wrong? The error is consistent across my integration tests as well as through the graph explorer.
Thanks
As Sriram mentioned, this was a documentation bug. It has just been fixed. The updated URL is: https://graph.microsoft.io/en-us/docs/api-reference/beta/api/plan_post_plans
The issue was in which endpoint to call to create a plan. You should call "/plans" instead of "/me/plans". You should also be aware that some of the data you are passing in is read-only. You should not include "createdBy" because this is a read-only property set by the service, not you. The plan resource documentation will show you all of the properties that can be set on a plan.
The last thing to keep in mind is that you can only have one plan per group. If you try to make a second plan, you'll receive an error about this from the API.
In Juli 2017 the API was modified and released. The new endpoint for creating a plan now is:
https://graph.microsoft.com/v1.0/planner/plans
with a request body e.g. like this:
{
"owner": "<group-id>",
"title": "my plan title"
}
where <group-id> must be the id of a previously created group.
Apologies for the confusion here. The documentation has a bug will be updated shortly. To create a plan, please ensure that a group is created, and the user is member of group. Then create the plan with owner set to group id, and createdBy set to user id.
For this issue, can you please try following the below steps exactly?
Create a unified group
Add user to be member of unified group
Create plan by sending {“owner”: group-id, “title”: string} - do not send "createdBy" field since it's a read-only field
For adding tasks to buckets, it should work just fine if you sent
{“planId”: plan-id, “bucketId”: bucket-id, “title”: string}
If this still doesn't work, feel free to reach out to me at lixian#microsoft.com.
Thanks,
Sean

SendGrid spec differences between versions of Event Notification Webhook

I have an existing rails3 application with SendGrid Service integration based on SMTP relay, and subscribed to Event Notification Webhooks.
I've got reminder email from Service, informing about impending change to SendGrid's service, and I need make some changes to match new version of Event Notification Webhooks v3.
Email I got contains instructions about How To Upgrade:
Review the documentation to understand how to consume this new version's events.
Implement changes on your side to handle the new in-formatting of event data.
Make changes on SendGrid's configuration page
I wounder, what changes now need I implement on my site? I read manual for v3, but there no information about specifications differences between old and new versions.
Previously, the SendGrid event webhook sent improper batched JSON, with documents seperated by line breaks:
{ "email": "john.doe#sendgrid.com", "timestamp": 1337197600, "smtp-id": "<4FB4041F.6080505#sendgrid.com>", "event": "processed" }
{ "email": "john.doe#sendgrid.com", "timestamp": 1337966815, "category": "newuser", "event": "click", "url": "http://sendgrid.com" }
{ "email": "john.doe#sendgrid.com", "timestamp": 1337969592, "smtp-id": "<20120525181309.C1A9B40405B3#Example-Mac.local>", "event": "processed" }
Today, with v3 it sends proper JSON as such:
[
{
"email": "john.doe#sendgrid.com",
"timestamp": 1337197600,
"smtp-id": "<4FB4041F.6080505#sendgrid.com>",
"event": "processed"
},
{
"email": "john.doe#sendgrid.com",
"timestamp": 1337966815,
"category": "newuser",
"event": "click",
"url": "http://sendgrid.com"
},
{
"email": "john.doe#sendgrid.com",
"timestamp": 1337969592,
"smtp-id": "<20120525181309.C1A9B40405B3#Example-Mac.local>",
"event": "processed"
}
]
If you'd previously been dealing with non-batched events you'll need to adjust your code so that it interprets an array, rather than just a single document, and then loops through said array. Put into code:
# This
consume_data(params)
# Becomes this
params.each { |doc|
consume_data(doc)
}

Activiti - Get Process Instance Details" Java API

I am using Activiti 5.12. As provided, in its user guide, REST API to get he details of a process instance is :
GET /process-instance/{processInstanceId}
Its response is something like this :
{
"id": "2",
"processDefinitionId": "financialReport:1",
"businessKey": "55",
"startTime": "2010-10-13T14:54:26.750+02:00",
"startActivityId": "startFinancialAnalysis",
"startUserId": "kermit",
"completed": false,
"tasks": [
{
"taskId": "3",
"taskName": "Analyze report",
"owner": null,
"assignee": "Kermit",
"startTime": "2010-10-13T14:53:26.750+02:00",
"completed": false
}
],
"activities": [
{
"activityId": "4",
"activityName": "Get report",
"activityType": "ServiceTask",
"startTime": "2010-10-13T14:53:25.950+02:00",
"completed": true,
"duration": 200
}
],
"variables": [
{
"variableName": "reportName",
"variableValue": "classified.pdf"
}
],
"historyVariables": [
{
"variableName": "reportName",
"variableValue": "classified.pdf",
"variableType": "String",
"revision": 1,
"time": "2010-10-13T14:53:26.750+02:00"
}
]
}
A JAVA API for the same is also provided, which is :
ProcessEngines.getProcessEngine(configuredProcessEngineName).getHistoryService().createHistoricProcessInstanceQuery().processInstanceId("somevalue").singleResult()
This Java API does not work, as teh return type HistoricProcessInstance does not have the method to get the task list.
My objective is to get the current state of a process instance, i.e which task it's presently at.
The REST API lists all tasks that process instance has carried out and the last task of the list is the one it's currently executing, as its property completed is false.
I want to achieve the same from java code.
Can you please help me out. Any alternative way to get to my objective is also fine with me.
You can use another query of HistoricService API:
List<HistoricTaskIntance> taskList = getHistoryService()
.createHistoricTaskInstanceQuery()
.processInstanceId(processInstanceId)
.list()
The current task status can be defined by HistoricTaskInstance.getEndTime() that will return null for open tasks.
I have tried this way out.
SELECT NAME_ FROM act_hi_taskinst where PROC_INST_ID_= 1000 and END_TIME_ IS NULL;"
act_hi_taskinst contains history tasks for each and every instance.
If the process with instance id is completed then you wont get any result, so you can check that condition before moving forward.
I have run this piece of SQL Statement to get the required task name.
The answer given by #Mike also meets the objective. Even here also you have to check whether process is incomplete.

Resources