How can I detect sold-out tickets using the EventBrite API? - eventbrite

Event 6274606517 has multiple types of tickets, some of which have already ended. Two of the future tickets are sold out, two aren't. How can I get that information via the API?

You can get this in event_get by inspecting the tickets node.
Each ticket will include quantity_available and quantity_sold, in addition to other fields which I've left out:
"ticket": {
"currency": "USD",
"quantity_available": 6,
"quantity_sold": 1,
}
One thing to be aware of is that you must pass in your user_key to identify yourself as the owner of this event, since ticket sales are considered private.
If sold >= available, the ticket will be sold out.

Related

MS Graph API - how to retrieve declined events?

Let's say person B sends a calendar event invite to person A. When we then run the following query for person A, we can see the event in the response with responseStatus.response="notResponded", which is fine:
https://graph.microsoft.com/v1.0/me/events?startDateTime=2023-01-11T23%3A00%3A01.000Z&endDateTime=2023-01-12T23%3A00%3A00.000Z
However, when person A declines the invitation, then the event disappears from the response.
Is there a way to modify the query or use a different endpoint to still have access to the declined events?
I tried to look for the solution in the MS Graph API docs, but couldn't find any hints.
responseStatus property doesn't support filtering but as an alternative you can use extended property PidLidResponseStatus and filter those events with PidLidResponseStatus equals to respDeclined int value 4.
https://graph.microsoft.com/v1.0/me/events?startDateTime=2023-01-11T23%3A00%3A01.000Z&endDateTime=2023-01-12T23%3A00%3A00.000Z&$filter=singleValueExtendedProperties/any(ep:ep/id eq 'Integer {00062002-0000-0000-C000-000000000046} Id 0x8218' and cast(ep/value, Edm.Int32) eq 4)
But if declined event is remove from the calendar then it cannot be listed.
Documentation:
PidLidResponseStatus

Search Outlook Calendar Event categories for multiple hits - Microsoft Graph

I am trying to keep track of Outlook calendar events without the need to store information about them on my own systems. I decided to do this by adding the required ids as categories with their type of id before it as shown in the code sample below.
{
"#odata.etag": "",
"createdDateTime": "",
"categories": [
"ID1::abc123",
"ID2::def456"
]
}
I tried using the 'any' lambda operator and this works fine if I want to filter based on one category using the query below:
https://graph.microsoft.com/v1.0/me/events?$filter=categories/any(x:x%20eq%20'ID1::abc123')
What I need is a query that will check if an event has both ids so in this case only the events where ID1=abc123 and ID2=def456. I figured https://graph.microsoft.com/v1.0/me/events?$filter=categories/any(x:x%20eq%20'ID1::abc123')%20AND%20categories/any(x:x%20eq%20'ID2::def456') should do the trick but this keeps returning empty arrays.
Thanks in advance!
Since categories are available to the user (and this is going to look really strange in outlook), I would suggest you to use the transactionId on the events to store the external id. This will automatically deny your new event if you try to create a duplicate.
I know this isn’t the answer you were looking for, but using this solution will be much more feature proof.

How to query/filter from Microsoft Graph all groups where a user is owner

I would like to query from Microsoft Graph all groups where a specific user is owner.
I tried the following query:
https://graph.microsoft.com/v1.0/groups?$filter=owners/any(owner: owner/id eq '4dc60fe7-8009-4131-a4e9-80dc5e86f98f')
Unfortunately this returns a 400.
Does anyone know the correct OData query? Or is this not even supported by MS Graph?
It's not possible to filter on owners. The documentation states which properties can be $filter'ed.
Look for
Supports $filter
in the description of each property.
You are going to have to read all groups, pull out their owners, and do the filtering client side.
The memberOf endpoint returns all the groups of a given user:
https://graph.microsoft.com/v1.0/users/{ID or email}/memberOf
Will return:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups",
"value": [
{
"id": "XXXX-XXXX-XXXX-XXXX",
"displayName": "The group name",
"...":"...",
}
]
}
It is possible to get all groups with owners using single API call like this:
https://graph.microsoft.com/v1.0/groups?$expand=owners
and then select groups which have current user in owners collection.
You could use List ownedObjects graph API to do that where it gets the list of directory objects that are owned by the user.
But as the question is specifically about getting the list of groups that a user is owner of, you can use the below graph API where it gets the list of directory objects with odata.type as microsoft.graph.group:
GET https://graph.microsoft.com/beta/users/{User Object ID}/ownedObjects/microsoft.graph.group
And if you just want to get the group name and group ID, you can use $select,
GET https://graph.microsoft.com/beta/users/{User Object ID}/ownedObjects/microsoft.graph.group?$select=displayName,id

Not able to fetch Delayed data

I have set reqMarketDataType(MarketDataType.DELAYED). But then I am getting
"Requested market data is not subscribed"
error while fetching delayed data.
// API Version 9.72 and later Launch EReader Thread
m_reader = new EReader(client, m_signal);
m_reader.start();
new Thread() {
#Override
public void run() {
processMessages();
}
}.start();
Contract contract = new Contract();
contract.symbol("GOOG");
contract.exchange("SMART");
contract.secType("STK");
contract.currency("USD");
// Create a TagValue list
Vector<TagValue> mktDataOptions = new Vector<>();
// Make a call to start off data retrieval
client.reqMarketDataType(MarketDataType.DELAYED);
client.reqMktData(1001, contract, null, false, mktDataOptions);
}
Based on your market data type and error displayed, it is USA equity, you need to subscribe the market data. Please refer to the follow link:
The procedure to subscribe the market Data in IB
To use the market data page
Click Manage Account > Trade Configuration >Market Data.
Your current market data subscriber status (Professional or Non-Professional) is displayed in the page title. Market data subscriptions are organized by region (North America, Europe, Asia-Pacific).
The Market Data page appears.
To sign up for additional market data subscriptions, click the tab for the region you want, click the check box for each subscription you wish to add, then click Back.
If you have additional linked, duplicate or consolidated accounts, the Billable Account section appears on the page. Use this section to change the account that is billed for market data.
Select the account you want to be billed for market data, then click Change Billing Account. Beginning with the next billing cycle, your market data subscriptions will be billed to the account you selected.
To unsubscribe from market data, click the check box for the subscription to clear the check mark, then click Back.Read and complete any Subscriber Agreement that appears, then click Back.
The Market Data page opens again, with your new selections updated and any pending subscriptions identified as such. Market Data subscription updates take effect immediately under normal circumstances.
https://www.interactivebrokers.com.hk/en/software/am/am/manageaccount/marketdatasubscriptions.htm
Subscription considerations for U.S. market data (Non-Professionals)
Generally speaking, clients trading a broad variety of product classes should consider the basic bundled subscription referred to as the US Securities Snapshot and Futures Value Bundle which costs USD 10 per month and provides quotes for a variety of U.S. stocks, stock indices, bonds, futures and futures options. The monthly fee for this subscription is waived for any month in which the account generates at least USD 30 in commissions.
https://ibkr.info/node/2840

Fetch a list of portfolio positions from a brokerage account?

Use case which we want to built is a user will be presented with a list of financial institutions and when he selects anyone of it he needs to provide credentials to authenticate for selected institutions. Then brokerage account will be shown, clicking on it results into fetching of all portfolio positions.
So far what we have achieved:
Fetching list of all institutions, this we can achieve using
API method: getInstitutions
Selects an institution and authentication is performed (I am not sure this is the correct way of doing, if there is another way to do it then please let me know)
API method: discoverAndAddAccounts
Get all accounts associated with it and using Brokerage account id fetch all positions:
API method: getInvestmentPositions
Using above will return all positions but we can not differentiate between 'buy' and 'sell' action of a position.
Note: We are using this gem for the same: https://github.com/cloocher/aggcat
Thanks in advance.
First you have to know the definition of an option:
DEFINITION of 'Option'
A financial derivative that represents a contract sold by one party (option writer) to another party (option holder). The contract offers the buyer the right, but not the obligation, to buy (call) or sell (put) a security or other financial asset at an agreed-upon price (the strike price) during a certain period of time or on a specific date (exercise date).
Then by looking at the Intuit documenation we can see that:
positionType string
This is used to explain how long a position is held and differentiate between writers and holders of an option or other security.
E.g. SHORT = Writer for options,
Short - Write for all other securities,
LONG = Holder for options,
Long = Holder for all other securities. For Bonds, it is always "LONG".

Resources