Outlook Event API : At least one property failed validation error - json

I'm creating an Outlook event via Outlook API by providing following JSON input :
{
"subject":"bla bla bla",
"start":{
"dateTime":"2018-01-14T17:00:00",
"timeZone":"India Standard Time"
},
"Attendees": [
{
"EmailAddress": {
"Address": "janets#a830edad9050849NDA1.onmicrosoft.com",
"Name": "Janet Schorr"
},
"Type": "Required"
}
]
}
However I'm getting the following error response :
{
"error": {
"code": "ErrorPropertyValidationFailure",
"message": "At least one property failed validation.",
"innerError": {
"request-id": "6f3d1676-77cc-49b0-87a2-b96b6ed1f15d",
"date": "2018-01-12T05:25:10"
}
}
}
If I pass the end attribute in the above JSON, the event is created successfully. The below JSON works fine :
{
"subject":"bla bla bla",
"start":{
"dateTime":"2018-01-14T17:00:00",
"timeZone":"India Standard Time"
},
"end":{
"dateTime":"2018-01-14T17:00:00",
"timeZone":"India Standard Time"
},
"Attendees": [
{
"EmailAddress": {
"Address": "janets#a830edad9050849NDA1.onmicrosoft.com",
"Name": "Janet Schorr"
},
"Type": "Required"
}
]
}
Is it required to pass an end attribute for event creation? Or is there something wrong with the above JSON input?

Yes, end is required. Outlook/Exchange don't support events with no end date :)

Related

Firestore queries: Invalid Payload Received

What am I trying to do?
Query the field named price in documents inside the collection named product_page and return the document where price==100
What did I do?
URL:https://firestore.googleapis.com/v1/projects//databases/(default)/documents/product_page/
METHOD: POST
Request Body:
{
"structuredQuery": {
"from": [
{
"collectionId": "product_page",
"allDescendants": true
}
],
"where": {
"fieldFilter": {
"field": {
"fieldPath": "price"
},
"op": "EQUAL",
"value": {
"stringValue": "100"
}
}
}
What error do I get?
code": 400,
"message": "Invalid JSON payload received. Unknown name \"structuredQuery\" at 'document': Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "document",
"description": "Invalid JSON payload received. Unknown name \"structuredQuery\" at 'document': Cannot find field."
}
You use the wrong endpoint (or method).
With the following URL and a POST method
https://firestore.googleapis.com/v1/projects/.../databases/(default)/documents/product_page
you actually call the createDocument method.
You need to use the runQuery method, which allows passing a structuredQuery object.

Autodesk Forge API - Patch Item Input Error

I am trying to use the PATCH projects/:project_id/items/:item_id endpoint in order to update the "displayName" attribute of an item in BIM360. There is an example on how to do exactly that in the Forge documentation, but for some reason I am getting an 400 error.
Here is my payload:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "ITEM_URN",
"attributes": {
"displayName": "NEW_ITEM_NAME.EXTENSION"
}
}
}
Here is the error I get:
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "a4c43bbb-9e34-4973-9f9c-58a7e1d7bdb6",
"status": "400",
"code": "BAD_INPUT",
"title": "One or more input values in the request were bad",
"detail": "Request input is invalid for this operation."
}
]
}
I successfully use the same endpoint in order to change the parent folder for this same item (as described in this post answer: Autodesk Forge; Pragmatically changing file location without new upload ), so the problem must be in the update "displayName" portion. Here the successful payload sample that returns a 200 answer:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "ITEM_URN",
"relationships": {
"parent": {
"data": {
"type": "folders",
"id": "DESTINATION_FOLDER_URN"
}
}
}
}
}
Forge Documentation with example: https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-PATCH/
What am I missing in order to update the "displayName" attribute?
If you want to change the file name, you can change tip version name and title , creating new version is required, but you don't have to upload file again. Please try the API at https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-POST/ :
POST /versions?copyFrom={tip_version_urn}
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "versions",
"attributes": {
"name": "newName"
}
}
}
A new tip version will be created with the updated name.

how to use output.integration.slack in Watson Assistant json response

I build a chatbot with Watson Assistant and integrate it with Slack. I want to write Native JSON supported by Slack through Watson Dialog using JSON Editor. The doc of Watson Assistant says:
output.integrations.slack: any JSON response you want to be included in the attachment field of a response intended for Slack.
(see https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-responses-json#dialog-responses-json-user-defined)
So I tried sth like this:
{
"output": {
"integrations": {
"slack": {
"attachment": {
"blocks": [
{
"text": {
"text": "Pick a date for the deadline.",
"type": "mrkdwn"
},
"type": "section",
"accessory": {
"type": "datepicker",
"action_id": "datepicker-action",
"placeholder": {
"text": "Select a date",
"type": "plain_text",
"emoji": true
},
"initial_date": "1990-04-28"
}
}
]
}
}
},
"generic": [
{
"response_type": "text",
"values": [],
"selection_policy": "sequential"
}
]
}
}
The content of the attachment field is copied from the Block Kit Builer(https://api.slack.com/tools/block-kit-builder).
But this seems not work. Can anyone give me some suggestions? Thanks in advance.
Output.integrations is not a preferred way.
Pls try
"output": {
"generic": [
{
"user_defined": {
//Put here your slack attachment
},
"response_type": "user_defined"
}
]}
By using user_defined you can mix with it more responses like text, image, etc.

Jira rest api insert custom fields in create issue

I have following custom field. How do i pass it in JSON to create issue in jira using rest api
"customfield_10300":{
"required":false,
"schema":{
"type":"option",
"custom":"com.atlassian.jira.plugin.system.customfieldtypes:select",
"customId":10300
},
"name":"Severity",
"hasDefaultValue":false,
"operations":[
"set"
],
"allowedValues":[
{
"self":"http://sjira/rest/api/2/customFieldOption/10303",
"value":"Blocker",
"id":"10303"
},
{
"self":"http://sjira/rest/api/2/customFieldOption/10304",
"value":"Critical",
"id":"10304"
}
]
}
As the field is from type "select" you should use the JSON format to populate a select field:
Here an example:
{
"fields": {
"project":
{
"key": "PKEY"
},
"summary": "Your summary",
"description": "your description",
"issuetype": {
"name": "Task"
},
"customfield_10013": { "value": "Blocker" }
}
}
Some more details can be found here: https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue

Issues Parsing a Facebook Graph API JSON Message using JQuery $.each Function

I have been trying to access/parse the “message” object found in the JSON results hereafter, issued by the Facebook Graph API, using the Javascript JQuery $.each(function()) Function but without success. I am able to access the “name” object, but not the objects found in the statuses=>data array. I have tried a multitude of syntaxes, but without success. I was wondering if one could provide a syntactical example using the Javascript JQuery $.each(function()) Function of how I could access the “message” object. As you will notice, the “message” objects are found under the following structure: results=>friends=>data array=>statuses=>data array=>message.
{
"id": "idValue",
"friends": {
"data": [
{
"name": "NameValue",
"id": "idValue",
"statuses": {
"data": [
{
"message": "Msg1",
"updated_time": "Date",
},
{
"message": "Msg2",
"updated_time": "Date",
},
],
}
},
{
"name": "NameValue",
"id": "idValue",
"statuses": {
"data": [
{
"message": "Msg1",
"updated_time": "Date",
},
{
"message": "Msg2",
"updated_time": "Date",
},
],
}
}
],
}
}
Assuming that that block is stored in response:
console.log(response);
$.each(response.friends.data, function(i, friend){
console.log(friend);
$.each(friend.statuses, function(i, status){
console.log(status);
});
});
Un-tested, but it should work. It helps to console.log along the way to be sure what you're looking at. See the log in the inspector in Chrome or Firefox