When creating a new bookingCustomer object the displayName property value is replaced by emailAddress value:
POST https://graph.microsoft.com/beta/bookingBusinesses/Contosolunchdelivery#M365B489948.onmicrosoft.com/customers
Content-type: application/json
{
"displayName": "Joni Sherman",
"emailAddress": "jonis#relecloud.com"
}
Response:
HTTP/1.1 201 Created
Content-type: application/json
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#bookingBusinesses('Contosolunchdelivery%40M365B489948.onmicrosoft.com')/customers/$entity",
"id": "36038f36-634e-44e4-9415-d7d59c2347aa",
"displayName": "jonis#relecloud.com",
"emailAddress": "jonis#relecloud.com"
}
The example from docs (https://learn.microsoft.com/en-us/graph/api/bookingbusiness-post-customers?view=graph-rest-beta&tabs=http):
Same story over HTTP and SDK.
Any toughts?
Related
I am trying to update the task in Microsoft planner using Graph API in postman. I have already created a blank task and I am updating the created task using PATCH function to attach a file.
PATCH Request:
PATCH https://graph.microsoft.com/v1.0/planner/tasks/{task-id}/details
Content-type: application/json
Prefer: return=representation
If-Match: W/\"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAVCc=\"
{
"#odata.etag": "W/\"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAVCc=\"",
"previewType": "noPreview",
"references": {
"https%3A//my%2Esharepoint%2Ecom/sites/Test12/Shared Documents/Sample%2Edocx":
{
"#odata.type": "microsoft.graph.plannerExternalReference",
"alias": "Sample.docx",
"lastModifiedBy": {
"user": {
"id": "5442777a-0440-4a2f-9269-21824464e3a1"
}
},
"lastModifiedDateTime": "2022-09-05T11:06:47.6011074Z",
"previewPriority": "0009005756397228702",
"type": "word"
}
}
}
When i sent it it showed 400 Bad Request.
Response Error Message -
{
"error": {
"code": "",
"message": "The request is invalid:\r\nAn unexpected 'StartObject' node was found for property named 'lastModifiedBy' when reading from the JSON reader. A 'PrimitiveValue' node was expected.",
"innerError": {
"date": "2022-09-06T04:49:34",
"request-id": "37001992-fafb-461e-a4f0-9f1dafa34b21",
"client-request-id": "37001992-fafb-461e-a4f0-9f1dafa34b21"
}
}
}
Is there any issue with the body content?
I would like to send a request with a random value or using the current date in the json payload of the request's body in Blazemeter
Example:
method: POST
url: ${url}/transaction
headers:
Content-Type: application/json
body: {
"order": {
"id": uuidGenerator() + "test" ,
"timestamp": datetime( now() , 'yyyy/MM/DDTHH:mm:ssZ')
}
}
Doc references Test Data Generator Functions:
https://guide.blazemeter.com/hc/en-us/articles/360011769877-Test-Data-Generator-Functions-Test-Data-Generator-Functions
Expected
"order": {
"id": "7d052488-6fbf-11eb-9439-0242ac130002-test" ,
"timestamp": "2021-01-15T18:00:00Z"
}
But
id value is not interpreted "uuidGenerator() + "test"
syntax seems to be incorrect for timestamp and card in Blazemter taurus
method: POST
url: ${url}/transaction
headers:
Content-Type: application/json
body: {
"order": {
"id": "${__UUID()}" ,
"timestamp": "${__time(yyyy-MM-dd'T'HH:mm:ss'Z',)}"
}
}
more functions: https://jmeter.apache.org/usermanual/functions.html#__time
I am trying to create a VSTS webhook subscription for publisherId= tfs and eventType= tfvc.checkin. Here's the sample Post request :
Url : https://testvstsaccount.visualstudio.com/_apis/hooks/subscriptions?api-version=1.0
Request Body :
{
"publisherId": "tfs",
"eventType": "tfvc.checkin",
"resourceVersion": "1.0-preview.1",
"consumerId": "webHooks",
"consumerActionId": "httpRequest",
"publisherInputs": {
"path": "$/"
},
"consumerInputs": {
"url": "https://myservice/myhookeventreceiver"
}
}
I am getting 400 Bad Request in response.
Response body :
{
"$id": "1",
"innerException": null,
"message": "Subscription input 'path' is not supported at scope 'collection'.",
"typeName": "Microsoft.VisualStudio.Services.ServiceHooks.WebApi.SubscriptionInputException, Microsoft.VisualStudio.Services.ServiceHooks.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"typeKey": "SubscriptionInputException",
"errorCode": 0,
"eventId": 4501
}
Can someone please help me understand the correct way to create this webhook.
The path is filtering to checkins that change one or more files under the specified path. It should look like $/TeamProject, or $/TeamProject/Project, or $/TeamProject/Project/.... $/ is not supported. Check my example below:
POST https://xxx.visualstudio.com/DefaultCollection/_apis/hooks/subscriptions?api-version=1.0
Content-Type: application/json
{
"consumerActionId": "httpRequest",
"consumerId": "webHooks",
"consumerInputs": { "url": "https://xxx.visualstudio.com" },
"eventType": "tfvc.checkin",
"publisherId": "tfs",
"publisherInputs": {
"path": "$/TestCase/TestCaseProject",
"projectId": "1decf66b-1974-43e3-xxxx-ba9a3fd2xxxx"
},
"resourceVersion": "1.0",
"scope": 1
}
Following this guide:
http://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/item_invite
I do the following post request:
POST /v1.0/me/drive/items/01OL4PFB56Y2GOVW7725BZO354PWSELRRZ/invite
Accept: */*
Accept-Encoding: gzip, deflate
Content-Type: application/json
Authorization: Bearer eyJ0e....
Accept-Language: es-es
{
"recipients": [
{
"email": "a-real-email#at-a-office365-account.com"
}
],
"message": "Here's the file that we're collaborating on.",
"requireSignIn": true,
"sendInvitation": true,
"roles": [ "edit" ]
}
And I get this response code:
{
"error": {
"code": "invalidRequest",
"message": "One of the provided arguments is not acceptable.",
"innerError": {
"request-id": "37c754c4-ace7-4582-9c6a-171633d1e335",
"date": "2016-09-29T10:17:18"
}
}
}
This is just the example at the docs, but I tried with different values for email, removing message, sendInvitation=false, I get the same error. I don't understand what argument is incorrect.
UPDATE 1:
After changing 'edit' to 'write', I get this error:
{
"error": {
"code": "notAllowed",
"message": "The action is not allowed by the system.",
"innerError": {
"request-id": "644408df-05f6-4406-9503-b5c16da17976",
"date": "2016-09-30T12:09:02"
}
}
}
The role should be write and not edit -- looks like we have a bug in the docs. Thanks for pointing this out! We'll get it fixed.
my application should sent structure via json,
that functions works fine:
function send_json()
{
var formData = form2object('myForm');
var json_data = JSON.stringify(formData, null, '\t');
$.post("", json_data);
}
It create json_data and send it via post.
But I don't understand how to catch this data on another side, can you help me ?
I should take this structure and make some actions with it.
when i send data i got json:
{ "type": "test", "ttl": "1", "amount": "1", "rules": { "rule1": "1", "value1": "4444", "stackcount1": "1", "rule2": "2", "value2": "333", "stackcount2": "2" }}
In the contoller i wrote this:
class AdminController < ApplicationController
def index
#json_string = params[:amount]
if !#json_sting.nil?
#json_string = JSON.parse(params[:amount])
end
end
end
in the view(haml) i wrote:
=#json_string
It doesn't work !
But wireshark shows:
POST /admin/ HTTP/1.1
Host: localhost:3000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept: */*
Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://localhost:3000/admin/
Content-Length: 192
Cookie: _GiftSenderTool_session=BAh7BzoQX2NzcmZfdG9rZW4iMTVyNVJCMTBvcGpKSk5OcFN4bW15YVlpRlF1TUNtb1gwZkY0bTRuRHlsNnM9Ig9zZXNzaW9uX2lkIiU4ZjFjNTNjNTY0MTQ1MGExNmFiODcxZGEyYzU5ZTkxMg%3D%3D--f21bf3b96edc3bc551c8de68acc6da17685d58b4
Pragma: no-cache
Cache-Control: no-cache
{
."type": "test",
."ttl": "1",
."amount": "1",
."rules": {
.."rule1": "1",
.."value1": "4444",
.."stackcount1": "1"
.},
."authenticity_token": "n3B6D/Km9zOgOzlosK/OLHyTCDLk3MyCTlTBinfQcnY="
}
It means that i can't get data.
you have to catch your JSON object in some rails controller action. If your JSON string looks like this:
{ "user": { "id": 1, "name": "Tom" } }
then do it like this:
require "json"
...
def some_action
user = JSON.parse(params[:user])
puts "User id is #{user[:id]}"
...
end