Creating a calendar event on windows live REST API - windows-live

I'm always getting time-outs (60sec) after making a post to create an event.
URL: https://apis.live.net/v5.0/me/events
JSON: {
"id": "",
"name": "Google 3",
"description": "mychild event",
"calendar_id": "calendar.c988c1d9bf3dcf4b.adasdasdeqe3231q23",
"start_time": "2014-04-30T08:30:00-05:00",
"end_time": "2014-04-30T09:30:00-05:00",
"is_all_day_event": false,
"visibility": "public"
}
I pass the access_token on the http headers with the format: Authorization: Bearer + AccessToken.
I've successfully created this very same event using the ISDK.
What I'm doing wrong? Any hint?
Tks,

Related

where do I get the secret property for creating webhook for azure speech to text service

If you look at the properties key,secret value is SecretUsedToCreateHMACHexDigestThatYouWillFindIn
where do i get this value from ?
{
"displayName": "TranscriptionCompletionWebHook",
"properties": {
"secret": "SecretUsedToCreateHMACHexDigestThatYouWillFindIn\"X-MicrosoftSpeechServices-Signature\"HeaderWhenBeingCalledBack"
},
"webUrl": "https://contoso.com/call/me/back",
"events": {
"transcriptionCompletion": true
},
"description": "I registered this URL to get a POST request for each completed transcription."
}

Create custom Azure DevOps Service Connection for rest api

I have a REST API on the internet that is secured with Azure AD and a required header (custom apikey).
You can call this API in example with postman using the client credentials flow. This all works fine.
I'm now developing a custom Azure DevOps extension that is showing the information returned from that API in the workitem form of ADO. I can call the API (if I remove the security from the API) from the extension through a generic Service Connection. Now I want to get the security working.
So I want to create a custom service connection that will get an accesstoken from the azure AD using ClientID and ClientSecret (client credentials flow).
When I have that working, I can call my API on a secure way.
Also how do I add the mandatory header to the call to the api? I need to add the header as field to the service connection as well right?
So I think I end up with a custom service connection instance that asks for TenantId, ClientId, Client Secret, Audience/Scope, List of headers (name/value).
For a more reference blog post I used this one: https://thingswithcode.blogspot.com/2019/07/using-azure-devops-service-connections.html
{
"id": "api-service-connection",
"description": "Service connection for api",
"type": "ms.vss-endpoint.service-endpoint-type",
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"properties": {
"name": "Call API",
"displayName": "Call API",
"icon": "img/world.png",
"url": {
"displayName": "API Url",
"value": "https://path-to-api",
"helpText": "Url of the API to connect to."
},
"inputDescriptors": [
{
"id": "api-key",
"name": "API Key",
"description": "The value for the header 'ApiKey'",
"inputMode": "textbox",
"isConfidential": false,
"validation": {
"isRequired": true,
"dataType": "string"
}
}
],
"authenticationSchemes": [
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-oauth2" // this is wrong...
}
],
"headers": [
{
"name": "ApiKey",
"value": "{{endpoint.api-key}}"
}
],
"helpMarkDown": "<b>Learn more</b>"
}
}
Thanks

insert row in Azuresqldatabase by using Azure Logic Apps

I am having Azure SQL database and I want to perform Insert,Update,Delete Operations by using Logic Apps
and is it necessary to have a gateway while Connecting to Azure SQL DB to Sqlserver Connector in Logic -app I have Three properties 1)Id 2)Name 3)Department in Azure SqlDB
**When HTTP Request is Received Code:**
{
"headers": {
"Accept": "application/json",
"Content-Type": "application/json"
},
"properties": {
"Department": {
"type": "string"
},
"Name": {
"type": "string"
},
"id": {
"type": "integer"
}
},
"type": "object"
}
Http Request is Received
In sql Connector it showing Bad request:
Insert -row Connector
The Body element of properties are null
{ "Department": null, "Name": null, "id": null }
The Output of Insert Row Connector
{
"statusCode": 400,
"headers": {
"Pragma": "no-cache",
"x-ms-request-id": "3332d425-3e10-4f04-b618-63f359168acc",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "false",
"Cache-Control": "no-store, no-cache",
"Date": "Mon, 04 May 2020 08:16:24 GMT",
"Content-Length": "468",
"Content-Type": "application/json",
"Expires": "-1"
},
"body": {
"status": 400,
"message": "Microsoft SQL: Cannot insert the value NULL into column 'id', table '.dbo.Details'; column does not allow nulls. INSERT fails.\r\nclientRequestId: 3332d425-3e10-4f04-b618-63f359168acc",
"error": {
"message": "Microsoft SQL: Cannot insert the value NULL into column 'id', table 'dbo.Details'; column does not allow nulls. INSERT fails."
},
"source": "sql-eus2.azconn-eus2.p.azurewebsites.net"
}
}
Note:I am not using any gate-way please guide me on the above task if you have any resource please let me
know
Logic App-Defination:
Designer
previous error history:
error:
data I am Passing in Payload schema:
enter image description here
The error is occurring because you are running the trigger from the azure portal. See when I run the trigger as shown in the image below,
And I encounter following error
"Microsoft SQL: Cannot insert the value NULL into column 'id', table 'librarymanagement.dbo.DepartmentTable'; column does not allow nulls. INSERT fails."
To properly invoke the HTTP trigger Logic APP, you need to make a HTTP API call to it. If you are just learning, you can use POSTMAN to make the call. Following are the steps you need to do
Copy the Logic APP url from the portal.
Create a new request in postman and select POST method and paste the url copied in step 1. Also paste the body as shown.
Now move to Headers and Set the values as shown below.
Click on Send

"Signature is Invalid" message for AppCenter Webhook request

I am trying to write a proxy service between GitHub API and AppCenter API and when I am trying to reroute a standard GitHub API message I am getting a "Signature is invalid" response.
Here's what I am attempting to send:
{
"ref": "refs/heads/xxxx",
"before": "xxxxxxxxxxxxx",
"after": "xxxxxxxxxxxxx",
"created": false,
"deleted": false,
"forced": false,
"base_ref": null,
"compare": "https://github.com/xxxxx",
"commits": [{
"content": "xxxx"
}],
"head_commit": {
"content": "xxxx"
},
"repository": {
"content": "xxxx"
},
"pusher": {
"content": "xxxx"
},
"organization": {
"content": "xxxx"
},
"sender": {
"content": "xxxx"
}
}
AppCenter's endpoint is:
https://api.appcenter.ms/v0.1/public/apps/xxxxxxxxxxx/hooks
Request's headers are:
{
"content-type": "application/json",
"User-Agent": "GitHub-Hookshot/xxxxxxxx",
"X-GitHub-Delivery": "xxxxxxxxxxxxxx",
"X-GitHub-Event": "push",
"X-Hub-Signature": "sha1=xxxxxxxxxxx"
}
Here's the response I am getting:
{
"id": "xxxxxxxxxxxxxxxx",
"message": "Signature is invalid"
}
I've yet to receive a sensible answer from AppCenter, hope somebody already had a similar experience and can answer.
Thanks
I think the issue is the value of X-Hub-Signature. From Validating payloads from Github, Github uses a HMAC SHA1 between the payload data & the secret string you have put in the webhook section of your repository :
The signature format (without brackets):
sha1={HMAC-SHA1(secret, payload)}
A few examples to compute the signature :
using ruby (from here) :
signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body)
using javascript (from here) :
var signature = 'sha1=' + CryptoJS.HmacSHA1(payload, environment.secret).toString(CryptoJS.enc.Hex)

How can I create a calendar event on Outlook with Microsoft Graph API?

I have an app that integrates with Office365 and I am attempting to create a calendar event on an Outlook calendar using the Microsoft Graph API. Here is what I have so far:
request.post({
url:'https://graph.microsoft.com/v1.0/me/events',
form: {
"Id": null,
"Subject": "Discuss the Calendar REST API",
"Body": {
"ContentType": "Text",
"Content": "This is some content."
},
"Start": {
"DateTime": "2016-01-24T18:00:00",
"TimeZone": "Pacific Standard Time"
},
"End": {
"DateTime": "2016-01-25T19:00:00",
"TimeZone": "Pacific Standard Time"
},
"ShowAs": "Free",
"IsReminderOn":false
},
headers: {
"Authorization": "Bearer " + access_token,
"Content-Type": "application/json"
}
}, function(err, httpResponse, body) {
if (err) {
console.log('addMicrosoftAccessToken() ERROR = ' + err);
callback(err, false);
} else {
console.log('httpResponse = ' + JSON.stringify(httpResponse));
callback(null, true);
}
})
The problem is that the event isn't saved on the users Outlook calendar. Also, I'm not getting an error in the log. I suspect that I'm not sending the proper form data in the request. Any ideas?
UPDATE: Here is the httpResponse I'm getting in the log:
{
"statusCode": 500,
"body": "{\r\n \"error\": {\r\n \"code\": \"UnknownError\",\r\n \"message\": \"\",\r\n \"innerError\": {\r\n \"request-id\": \"8ebe2efc-649c-4d8d-bee1-be2457cc3a45\",\r\n \"date\": \"2016-01-25T19:05:27\"\r\n }\r\n }\r\n}",
"headers": {
"cache-control": "private",
"transfer-encoding": "chunked",
"content-type": "application/json",
"server": "Microsoft-IIS/8.5",
"request-id": "8ebe2efc-649c-4d8d-bee1-be2457cc3a45",
"client-request-id": "8ebe2efc-649c-4d8d-bee1-be2457cc3a45",
"x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"East US\",\"Slice\":\"SliceB\",\"ScaleUnit\":\"000\",\"Host\":\"AGSFE_IN_4\",\"ADSiteName\":\"EST\"}}",
"outboundduration": "707.5019",
"duration": "713.2419",
"x-powered-by": "ASP.NET",
"date": "Mon, 25 Jan 2016 19:05:27 GMT",
"connection": "close"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "graph.microsoft.com",
"port": 443,
"hostname": "graph.microsoft.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/v1.0/me/events",
"path": "/v1.0/me/events",
"href": "https://graph.microsoft.com/v1.0/me/events"
},
"method": "POST",
"headers": {
"Authorization": "Bearer blah blah",
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
"content-length": 643
}
}
}
UPDATE 2:
This link is titled "Create Event", and appears to have the response listed in both the request and response sections, making it particularly confusing:
http://graph.microsoft.io/docs/api-reference/v1.0/api/event_post_instances
Also, in the above link where it lists
POST https://graph.microsoft.com/v1.0/me/events/<id>/instances
what is <id>? It doesn't tell me what id is supposed to be?
UPDATE 3: This link is also titled "Create Event", yet it has a different POST URL:
http://graph.microsoft.io/docs/api-reference/v1.0/api/user_post_events
Very confusing.
The reason why your me/events request fails is that you used the Azure Active Directory (AAD) authorization flow for accessing your personal Microsoft Account (Live Id) calendar. AAD allows creating users mapped to Microsoft Accounts such that when requesting an AAD token you're signing in with your Microsoft Account credentials. That way your credentials can be used to access both business (work or school) and consumer (personal) services. While the credentials are shared there are 2 distinct user accounts. When accessing business services like OneDrive for Business or SharePoint you need to sign in with the AAD user account in the context of your work or school organization. When accessing consumer services like Hotmail or OneDrive you need to sing in with the Microsoft Account (Live Id). You request is attempting to access an Outlook account in the context of your organization, which doesn't exist as your email address is already served by a personal Outlook account associated with your Microsoft Account. Please use the converged authorization flow (http://graph.microsoft.io/en-us/docs/authorization/converged_auth) to sign in with your personal Microsoft Account and you'll be able to access your personal email and calendar. Alternatively you can keep using the AAD authorization flow to access work or school calendars for AAD users not mapped to Microsoft Accounts.

Resources