Passing the value of the select list, to the callback url body on office365 connector card? (payload format) - office365connectors

I'm trying to develop a connector.
I have created the card and the webhook and entered a callback URL to my node.js server for httpost action. I can't get the value of the select list to pass to my server when I click send.
I tried including a body string at the card but then I get
SyntaxError: Unexpected token # in JSON at position 0.
When I send without a body it communicates with my server but I cant get the values. I log the request and there are nowhere.
Below is the a section of the code sample of one office365 connector cards for outlook. It is written in the card reference that the httppost action can contain a body. So i assume this body will be sen to my server with the valu ethat i define. But when i include the body i get the above error and the action doesn't complete as it does without a body.
{
"#type": "ActionCard",
"name": "Move",
"inputs": [
{
"#type": "MultichoiceInput",
"id": "move",
"title": "Pick a list",
"choices": [
{ "display": "List 1", "value": 500 },
{ "display": "List 2", "value": 600 }
]
}
],
"actions": [
{
"#type": "HttpPOST",
"name": "Save",
"target": "https://aptdevserver.westeurope.cloudapp.azure.com/chat/messages/create",
"body": "value",
"bodyContentType": "application/json"
}
]
}

You're not telling Outlook which value you want to send. You need to tell it that you want to do a string replacement, otherwise you are litterally sending the string value in the body of your POST:
"body": "{ \"move\": \"{{move.value}}\" }"
Using your complete example:
{
"#type": "ActionCard",
"name": "Move",
"inputs": [
{
"#type": "MultichoiceInput",
"id": "move",
"title": "Pick a list",
"choices": [
{ "display": "List 1", "value": 500 },
{ "display": "List 2", "value": 600 }
]
}
],
"actions": [
{
"#type": "HttpPOST",
"name": "Save",
"target":
"https://aptdevserver.westeurope.cloudapp.azure.com/chat/messages/create",
"body": "{ \"move\": \"{{move.value}}\" }",
"bodyContentType": "application/json"
}
]
}

Related

INVALID_PATCH_PATH error while using patch/updating the interval unit in PayPal plan update API

I used the details in body as
[
{
"op": "replace",
"path": "/billing_cycles/frequency/interval_unit",
"value": "MONTH"
}
]
I get the output as follows
{
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "7e77554e0bd6d",
"details": [
{
"field": "/0/path",
"value": "/billing_cycles/frequency/interval_unit",
"location": "body",
"issue": "INVALID_PATCH_PATH",
"description": "The specified field cannot be patched."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/v1/billing/subscriptions#INVALID_REQUEST",
"rel": "information_link",
"method": "GET"
}
]
}
what is the correct body data to pass to update the interval_unit of the PayPal plan data.
"issue": "INVALID_PATCH_PATH",
"description": "The specified field cannot be patched."
The error message is correct, that field cannot be patched.
See the update API call's documentation for fields that can patched.
If you need a plan with different billing cycles, create a new plan.

AWS API Gateway (REST) - Request Validation passes even when there is unknown property

I have an API gateway with the following schema:
{
"swagger": "2.0",
"info": {
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"version": "1.0.0",
"title": "Swagger Petstore",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"email": "apiteam#swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"paths": {
"/pet": {
"post": {
"summary": "Add a new pet to the store",
"description": "",
"operationId": "addPet",
"consumes": [
"application/json",
"application/xml"
],
"produces": [
"application/xml",
"application/json"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "Pet object that needs to be added to the store",
"required": true,
"schema": {
"$ref": "#/definitions/Pet"
}
}
],
"responses": {
"405": {
"description": "Invalid input"
}
}}
}},
"definitions": {
"Pet": {
"required": ["id", "name"],
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Id of the pet",
"example": 123
},
"name": {
"type": "string",
"description": "Name of the pet",
"example": "Jammy"
},
"nickname": {
"type": "string",
"description": "Nickname of the pet",
"example": "Jam"
}
}
}
}
}
When I send a request body with fields which are not present in the schema, I don't get 400 response from API gateway. I have applied the configuration to Validate body, headers, query string.
Is this an open issue in API gateway? Or am I missing something?
So with swagger v2 and openapiv3 specs the default behavior is to accept all additional properties that your spec does not define. If you include the required pet id and name and additional unused propertues like foo and bar, you post should succeed.
If you want more strict validation that fails when additional properties are sent then set additionalProperties to false in your pet schema or do that and change the spec version to 3.x.x

List users as non admin with custom fields

As per the documentation, I should be able to get a list of users with a custom schema as long as the field in the schema has a value of ALL_DOMAIN_USERS in the readAccessType property. That is the exact set up I have in the admin console; Moreover, when I perform a get request to the schema get endpoint for the schema in question, I get confirmation that the schema fields are set to ALL_DOMAIN_USERS in the readAccessType property.
The problem is when I perform a users list request, I don't get the custom schema in the response. The request is the following:
GET /admin/directory/v1/users?customer=my_customer&projection=full&query=franc&viewType=domain_public
HTTP/1.1
Host: www.googleapis.com
Content-length: 0
Authorization: Bearer fakeTokena0AfH6SMD6jF2DwJbgiDZ
The response I get back is the following:
{
"nextPageToken": "tokenData",
"kind": "admin#directory#users",
"etag": "etagData",
"users": [
{
"externalIds": [
{
"type": "organization",
"value": "value"
}
],
"organizations": [
{
"department": "department",
"customType": "",
"name": "Name",
"title": "Title"
}
],
"kind": "admin#directory#user",
"name": {
"fullName": "Full Name",
"givenName": "Full",
"familyName": "Name"
},
"phones": [
{
"type": "work",
"value": "(999)999-9999"
}
],
"thumbnailPhotoUrl": "https://photolinkurl",
"primaryEmail": "user#domain.com",
"relations": [
{
"type": "manager",
"value": "user#domain.com"
}
],
"emails": [
{
"primary": true,
"address": "user#domain.com"
}
],
"etag": "etagData",
"thumbnailPhotoEtag": "photoEtagData",
"id": "xxxxxxxxxxxxxxxxxx",
"addresses": [
{
"locality": "Locality",
"region": "XX",
"formatted": "999 Some St Some State 99999",
"primary": true,
"streetAddress": "999 Some St",
"postalCode": "99999",
"type": "work"
}
]
}
]
}
However, if I perform the same request with a super admin user, I get an extra property in the response:
"customSchemas": {
"Dir": {
"fieldOne": false,
"fieldTwo": "value",
"fieldThree": value
}
}
My understanding is that I should get the custom schema with a non admin user as long as the custom schema fields are set to be visible by all domain users. This is not happening. I opened a support ticket with G Suite but the guy that provided "support", send me in this direction. I believe this is a bug or maybe I overlooked something.
I contacted G Suite support and in fact, this issue is a domain specific problem.
It took several weeks for the issue to be addressed by the support engineers at Google but it was finally resolved. The behaviour is the intended one now.

Creating an eBay fulfilment policy. ("Please select a valid postage service.")

After a day of work with Postman, I have managed to reduce the number of errors down to 1. No idea how to get past it.
Definitely not an authorisation problem. I've been making lots of authorised calls.
URI:
POST https://api.ebay.com/sell/account/v1/fulfillment_policy
Body:
{
"categoryTypes": [
{
"name": "ALL_EXCLUDING_MOTORS_VEHICLES"
}
],
"freightShipping": "false",
"globalShipping": "false",
"handlingTime": {
"unit": "DAY",
"value": "1"
},
"localPickup": "true",
"marketplaceId": "EBAY_AU",
"name": "100 grams",
"shippingOptions": [
{
"costType": "CALCULATED",
"optionType": "DOMESTIC",
"shippingServices": [
{
"shippingCarrierCode": "Australia Post",
"shippingServiceCode": "AU_Regular"
}
]
}
]
}
Output:
{
"errors": [
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[0].shippingService"
}
]
}
]
}
Things I've Tried:
Deleting "shippingOptions": [...] (and everything inside the []s) got rid of the errors and resulted in the successful creation of a new fulfillment policy. However, I wanted to include shipping options in my call.
shippingCarrierCode doesn't seem to do anything. I've changed it to all sorts of sensible and non sensible things, including deleting it entirely. No impact on the output.
Changing shippingServiceCode to anything non-standard (eg "shippingServiceCode": "potato") results in getting the exact same error, but twice instead of once. (See below) How can I get the same error twice with only one shipping option?
Including a domestic and international option, I get the same error twice also. (Same output as below, except the second DomesticItemShippingService[1].shippingService is instead DomesticItemShippingService[0].shippingService)
Making an international option AND a domestic option, BOTH with silly service names results in 3 errors. (I was expecting 4.)
Code:
{
"errors": [
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[0].shippingService"
}
]
},
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[1].shippingService"
}
]
}
]
}
What did I do wrong this time?
I did get an answer to my question. Not here, even though I sent them the link here, but I got the answer (eventually) through official eBay channels.
I'll post that answer here for everyone. I was thinking of adding correct stackoverflow formatting, but decided it would be better to leave the correct answer untouched from the original.
Hello Jonathon ,
Ignore my last message and Apologize for the confusion.
Here is the reason why you are getting the error:
You have to set "localPickup": "false", refer doc for your help:
https://developer.ebay.com/api-docs/sell/account/resources/fulfillment_policy/methods/createFulfillmentPolicy#request.localPickup
And you will get response as:
{ "name": "100 grams", "marketplaceId": "EBAY_AU",
"categoryTypes": [
{
"name": "ALL_EXCLUDING_MOTORS_VEHICLES",
"default": true
} ], "handlingTime": {
"value": 1,
"unit": "DAY" }, "shippingOptions": [
{
"optionType": "DOMESTIC",
"costType": "CALCULATED",
"shippingServices": [
{
"sortOrder": 1,
"shippingCarrierCode": "Australia Post",
"shippingServiceCode": "AU_Regular",
"freeShipping": false,
"buyerResponsibleForShipping": false,
"buyerResponsibleForPickup": false
}
],
"insuranceOffered": false,
"insuranceFee": {
"value": "0.0",
"currency": "AUD"
}
} ], "globalShipping": false, "pickupDropOff": false, "freightShipping": false, "fulfillmentPolicyId": "6104871000",
"warnings": [] }
Let us know if you need further assistance!!!
Best Regards, eBay Developer Support
Check them out here. Make sure you have all the required fields.
pickupDropOff
shippingOptions.shippingServices.shipToLocations.regionIncluded

Google People API detect merged contacts with syncToken - previousResourceNames not included

I am using the people API to allow users to create entities in my system from their google contacts, via the people API, and am storing the resourceName (i.e 'people/c7760106965272617307') to keep track of the google contact the entity was created from.
I want to be able periodically update the entities to match what is in google. i.e. if the contact updates the phone number the entity gets the updated phone number. So am a calling the list API passing the sync token to get the contacts that have changed since the last call. This works for updates, edits and deletes but I can't find a way to detect when two contacts have been merged in google contacts.
The docs state:
https://developers.google.com/people/api/rest/v1/people#Person.PersonMetadata
previousResourceNames[] Any former resource names this person has had.
Populated only for connections.list requests that include a sync
token.
So if I:
- Call the list API requesting a sync token
- Create Contact A and Contact B
- Call the list API passing the sync token, then I get just the two created contacts and a new sync token:
{
"resourceName": "people/c1465347538402693914",
"etag": "%EgcBAj0JPjcuGgQBAgUHIgxab0lZTFBvUU43bz0=",
"metadata": {
"sources": [
{
"type": "CONTACT",
"id": "1455f5d28afc531a",
"etag": "#ZoIYLPoQN7o=",
"updateTime": "2020-02-26T15:35:34.021Z"
}
],
"objectType": "PERSON"
},
"names": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "1455f5d28afc531a"
}
},
"displayName": "Contact A",
"familyName": "A",
"givenName": "Contact",
"displayNameLastFirst": "A, Contact"
}
]
},
{
"resourceName": "people/c4555919836853785218",
"etag": "%EgcBAj0JPjcuGgQBAgUHIgx2WmJHUUtjNTcxQT0=",
"metadata": {
"sources": [
{
"type": "CONTACT",
"id": "3f39e0f40cd35282",
"etag": "#vZbGQKc571A=",
"updateTime": "2020-02-26T15:35:44.056Z"
}
],
"objectType": "PERSON"
},
"names": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "3f39e0f40cd35282"
}
},
"displayName": "Contact B",
"familyName": "B",
"givenName": "Contact",
"displayNameLastFirst": "B, Contact"
}
}
If I then merge the two contacts, and then call the API passing the new sync token i get:
{
"resourceName": "people/c4555919836853785218",
"etag": "%EgcBAj0JPjcuGgQBAgUHIgxqNlFVYnIwaU9vVT0=",
"metadata": {
"sources": [
{
"type": "CONTACT",
"id": "3f39e0f40cd35282"
}
],
"deleted": true,
"objectType": "PERSON"
}
}
So TDLR; I can find out one of the contacts were deleted, but not that it was merged into another contact.
It seems like the previousResourceNames[] field would do exactly what I want, but I can't seem to make it return in the data, either on the try the API function on the docs:
https://developers.google.com/people/api/rest/v1/people.connections/list
or using the below nodjs code:
const service = google.people({version: 'v1', auth: authClient});
const result = await service.people.connections.list({
resourceName: 'people/me',
personFields: 'names,emailAddresses,phoneNumbers,metadata',
//requestSyncToken: true
syncToken: "insert token here"
});
console.info("Google Returned", JSON.stringify(result.data, null, 4));
I wonder if i need to grant extra scopes, or something else in the requested person fields.
Scopes Requested:
'https://www.googleapis.com/auth/contacts',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile'