Remove an event category from a single event? - microsoft-graph-api

I'm trying to use MS Graph to modify an event in my (Office 365) Outlook calendar such that it comes to have zero categories. Microsoft's "Update event" document doesn't seem to tell how I can do this.
Context:
I have an event with the "Foo" category already assigned.
Desired State:
For the event to have no category assigned at all.
What Has Worked:
I have successfully added a category to the event by specifying an array with a single string that is the display name of the category, like so:
URI: https://graph.microsoft.com/v1.0/me/calendar/events/<id>
Method: PATCH
Body:
{
"categories": ["Foo"]
}
What Hasn't Worked:
Setting "categories" to either an empty array ([]) or an array containing a single empty string ([""]) does not remove the category and does not return any error. Setting "categories" to null or [null] returns an error.
How can I modify an event to remove its category?

Using a Patch works okay for me
PATCH https://graph.microsoft.com/v1.0/me/events/AAMk...TTP/1.1
Host: graph.microsoft.com
{"categories":[]}
When you try this what do you see in the response ? are you seeing the categories set back to []. If you do but you don't see the change in the client it may just be related to sync time (eg Outlook in Cache mode etc).
Are you using any of the SDK's to do the update it maybe a bug or issue with those libraries when you have a null or empty value but you need to specify more what SDK or library your using.

Related

jira createmeta not showing all customfields

If I navigate to /rest/api/2/issue/createmeta/PROJ/issuetype/N (in this case, I'm getting Task), the list of fields returned is incomplete. There are a number of customfields that are in use (I can see them both in the tickets themselves, and also in /plugins/servlet/project-config/PROJ/fields ) that are in the createmeta data.
I'm really trying to do this in python jira, where I'm using "expand='projects.issuetypes.fields'" in the createmeta() call, but I figured I'd double-check the results in the rest API directly, and I'm getting the same results there, too.
This is happening in jira 8.20.7.
Essentially, what I'm trying to do, is to programatically get a name/id mapping of all fields in the ticket type. I'm having far more difficulty doing that than I thought there would be. I would do it based on /rest/api/2/field but the jira admins have allowed some duplicated names...
EDIT: I realized that it might be worth noting that some of the fields I'm looking for are coming from a ServiceDesk form, although, as far as I can tell, there's no way to determine that, since one of the missing fields contains the name of the form.
Why are you using createmeta endpoint?
Instead of that, in order to get all of the customfields and their values; just note their id and get the values from /rest/api/2/issue/{issueKey} endpoint.
When you send a GET request to /rest/api/2/issue/{issueKey} endpoint, you will get a JSON object which contains "fields" object in it.
And using the "fields" you can determine all of the values that include system fields (description, assignee, etc.) and custom fields (like customfield_<customfieldid>).
And for a general approach, you may want to look at the field types in that response.

Is it possible to get a single event's originalStart with Graph API?

I'm working with Microsoft's Graph API for Outlook calendar events, and I need to fetch the originalStart for exceptions to recurring events on a calendar.
When fetching events using the List events function, I am provided with the events' original start dates, but when I grab a single event using the Get event function, the object returned has no originalStart.
I do receive the event's originalStartTimeZone and originalEndTimeZone, but the original start date is simply missing.
The event resource lists this as a property for events, so I would expect it to be showing up. Any way to get this event without grabbing the entire list of events anew?
I ve checked and confirm originalStart is missing or giving null value. You can look over there as the issue is already known : https://github.com/microsoftgraph/microsoft-graph-docs/issues/4353
I am able to get the originalStart by specifying it in the select query parameter:
https://graph.microsoft.com/v1.0/me/events/<id>?$select=id,subject,originalStart

How to filter by value of an extension in Microsoft Graph?

I am trying to save some data to events using open extensions, and retrieve an event by the value of the extension I saved. I unfortunately couldn't find any documentation around it, and not sure if it is possible.
I am sure that the extensions are saved properly because when I use make a request to this URL in graph explorer it returns the data properly attached to the events:
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events?$filter=Extensions/any(f:f/id eq 'Com.MyCompany.prop_id')&$expand=Extensions($filter=id eq 'Com.MyCompany.prop_id')
Now what I want to do is to filter upon the value of the extension. For example, if I have 3 events that I created, I have different Com.MyCompany.prop_id values for each of them, say 1,2,3. What I want to do is to get back only the event with Com.MyCompany.prop_id = 3.
My tries:
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events?$filter=Extensions/any(f:f/value eq '3')&$expand=Extensions($filter=id eq 'Com.MyCompany.prop_id')
and
https://graph.microsoft.com/v1.0/me/calendars/{calendarId}/events?$filter=Extensions/any(f:f/id eq 'Com.MyCompany.prop_id' and f/value eq '3')&$expand=Extensions($filter=id eq 'Com.MyCompany.prop_id'), and some other tries that I don't remember.
Most of them returned RequestBroker--ParseUri: Could not find a property named 'value' on type 'Microsoft.OutlookServices.Extension'. or some other error.
I appreciate any help.

Select fields on Microsoft Graph list of Messages

I'm using Microsoft Graph to get a list of messages for a user.
I'm using the following URL
https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages
One important thing that is returned by this is the meetingMessageType when the message revolves around a meeting request.
I would also like to get the uniqueBody of the message. However, that's not provided by default. One needs to specifically ask for that field. I can do that by adding ?$select=uniqueBody to the URL.
However, that now means that I need to add the rest of the fields I want to the $select query parameter. That's not a big deal until I run into meetingMessageType. Microsoft Graph returns:
Could not find a property named 'meetingMessageType' on type 'Microsoft.OutlookServices.Message'.
What can I do to ensure I get both uniqueBody and meetingMessageType?
Try this:
$select=uniqueBody, microsoft.graph.eventMessage/meetingMessageType
Yogesh's answer is close but will result in a Only one level select is supported error.
As long as you don't care about the value of meetingMessageType, you can use this select:
$select=microsoft.graph.eventMessage, uniqueBody
You'll note that the results no longer include meetingMessageType as a property. The list however is limited to only those messages that are eventMessage, effectively giving you a result set filtered to only show meeting requests.

Magento API: get products from a category

Hi I can't find anywhere how to get a list of product by category id in Magento API. I am using Ruby XMLRPC library. When i call product.list, I get all my products, each one of them is like this:
{"product_id"=>"165", "sku"=>"mycomputer",
"name"=>"My Computer", "set"=>"39",
"type"=>"bundle", "category_ids"=>["27"]},
{"product_id"=>"166", "sku"=>"HTC Touch Diamond", "name"=>"HTC Touch Diamond",
"set"=>"38", "type"=>"simple", "category_ids"=>["8"]}
client.call('call',session_id,'product.list') gives me every product.
I tried client.call('call',session_id,'product.list',[:name=>{:like=>"%%computer"}]) gives me products with name containing computer.
I tried
client.call('call',session_id,'product.list',[:category_ids=>{:include=>"8"}])
client.call('call',session_id,'product.list',[:category_ids=>"8"])
client.call('call',session_id,'product.list',[:category_ids=>["8"]])
all these fail. I even tried replacing "category_ids" with "category_id"
In addition, the following line is not working either. What did I do wrong?
client.call('call',session_id,'product.info',[:product_id=>xxx])
Neither Magento API and Ruby XMLRPC API can tell me what the correct syntax should be. Anyone has any other suggestions?
You need to use the catalog_category.assignedProducts API method.
From the documentation:
Retrieve list of assigned products
Return: array
Arguments:
int $categoryId - category ID mixed $store - store ID or code
Aliases:
category.assignedProducts

Resources