I created an Expense record and linked to an Invoice. When i import Invoice object through API, it has linked transaction as below.
"LinkedTxn":[{
"TxnId":"1356", //Id of Expense
"TxnType":"ReimburseCharge" //Type showing as ReimburseCharge
}]
In Quickbooks online docs, it is mentiond as
Links to expenses incurred on behalf of the customer are returned in
the response with LinkedTxn.TxnType set to ReimbCharge, ChargeCredit
or StatementCharge corresponding to billable customer expenses of type
Cash, Delayed Credit, and Delayed Charge, respectively. Links to these
types of transactions are established within the QuickBooks UI, only,
and are available as read-only at the API level.
Use LinkedTxn.TxnLineId as the ID in a separate read request for the
specific resource to retrieve details of the linked object.
In response it is showing TxnType as ReimburseCharge, but I didn't see any object like that in api explorer or docs. I don't know what type of object to request with id. I tried with Purchase, PurchaseOrder, Bill etc. but not of the request returned expected expense record.
Please help on how to access this Expense record with linked transaction id through api.
Invoice JSON:
Invoice line with description Printing paper is the expense linked in this invoice.
{
"Invoice":{
"Id":"1358",
"LinkedTxn":[
{
"TxnId":"1356",
"TxnType":"ReimburseCharge"
}
],
"Line":[
{
"Id":"1",
"LineNum":1,
"Description":"Printing paper",
"DetailType":"DescriptionOnly",
"DescriptionLineDetail":{
}
},
{
"Id":"3",
"LineNum":2,
"Description":"Magazine Monthly",
"Amount":100.0,
"DetailType":"SalesItemLineDetail",
"SalesItemLineDetail":{
"ItemRef":{
"value":"19",
"name":"Publications:Magazine Monthly"
},
"UnitPrice":100,
"Qty":1,
"TaxCodeRef":{
"value":"NON"
}
}
},
{
"Amount":250.0,
"DetailType":"SubTotalLineDetail",
"SubTotalLineDetail":{
}
}
],
"Balance":250.0
}
}
The docs are a little confusing on this point - unfortunately, the second paragraph
Use LinkedTxn.TxnLineId as the ID in a separate read request for the specific resource to retrieve details of the linked object.
is a generic paragraph that appears for docs on every Ref type, but shouldn't appear here. It's impossible to access these transactions via the API. More detail available here.
Related
Starting with a sample oauth app I am trying to retrieve info about an online meeting that occurred.
Create the client:
var graphClient = _graphServiceClientFactory.GetAuthenticatedGraphClient((ClaimsIdentity)User.Identity);
Make request:
var returnObj = await graphClient.Me.OnlineMeetings.CreateOrGet(meetingID).Request().PostAsync();
The problem is the lack of information returned. I am trying to retrive the chat from the meeting, which seems like it should be in returnObj.ChatInfo but this is all I get back:
{
"threadId":"19:meeting_SOMELONGUNIQUESTRINGHERE#thread.v2",
"messageId":"0",
"#odata.type":"microsoft.graph.chatInfo"
}
Also missing are the attendees in Participants (count=0). I know there are non zero attendees and that a chat log exists.
Trying Select or Expand does not help. Select returns nothing new,and expand gives an error along the lines of Message: Parsing OData Select and Expand failed: Property 'participants' on type 'microsoft.graph.onlineMeeting' is not a navigation property or complex property. Only navigation properties can be expanded., and similarly for chatinfo.
Also, using the threadId I thought maybe I could do this:
var groups = await graphClient.Groups.Request().GetAsync();
Group group = groups[0];
ConversationThread chat;
chat = await graphClient.Groups[group.Id].Threads[chatId].Request().GetAsync();
where for chatId I used the threadId from chatinfo, wholey and parsed out in different ways but I get Not Found.
No idea if what I'm trying to do is even possible as the documentation is rather lacking in terms of tying different pieces together (Like what is the threadId for? where is it used?).
Also, here are the various scopes I am requesting
"GraphScopes": "User.Read User.ReadBasic.All Mail.Send OnlineMeetings.ReadWrite Group.Read.All Team.ReadBasic.All"
I am fetching all the Accounts that have subscribed to the authenticated user's channel.
Is there a way to obtain the timestamp of when the user has subscribed to the channel?
The default "publishedAt" sadly is of no help because that seems to be the timestamp of when the channel was created.
Also, that is not part of the "subscriberSnippet"-Section
Twitch and Mixer both provide "created_at", but the YouTube-API is a whole other story...
Thank you very much,
~ Daniel
Based from the official documentation of Youtube API:
Subscriptions: list
retrieves a list of channels that the specified channel subscribes to.
You can view here the subscriptions resource and publishedAt is part of it:
snippet.publishedAt datetime
The date and time that the subscription was created. The value is specified in ISO 8601
(YYYY-MM-DDThh:mm:ss.sZ) format.
You can try the try this section from the documentation and check your Youtube Subscibers List using Creator Studio by following the steps here.
Note: The list only shows subscribers who have chosen to make their
subscriptions public. When a user first joins YouTube, their
subscriptions list is set to private by default.
Yes, here's an example in Python
import requests
headers = {
'Authorization': 'Bearer {0}'.format(token),
'Client-Id': client_id
}
query = {
'part': 'subscriberSnippet,snippet',
'mySubscribers': 'true',
'key': youtube_key
}
if cursor is not None:
query['pageToken'] = cursor
response = requests.get(
'https://youtube.googleapis.com/youtube/v3/subscriptions',
headers=headers, params=query)
res = response.json()
weirdly, snippet contains your authenticated user channel description and title but publishedAt field corresponds to when the item from subscriberSnippet subscribed to your authenticated user
I am using .Net sdk of GoToMeeting.
I want to get meetings organized by particular organizer.
I have tried using
MeetingsApi.getHistoryMeetings but it does not return me OrganizerKey so I can not filter on particular Organizer.
Is there any way to get meeting(s) based on organizer or even by Attendee email ID by using .Net SDK?
What is the problem you are facing with MeetingsApi.getHistoryMeetings();?
why you need to filter the method, the MeetingsApi.getHistoryMeetings(accessToken,true,date1,date2); itself filtered for a particular user right?
Look on the arguments we are passing in the method?
accessToken - This token is generated as a result of successful authentication of a gotoproduct account. (In API call it can be generated using directlogin orOauth method.
true - this represents whether the meetings returned are past or not.
date1 - Start date range for the meetings.
date2 - End date range for the meetings.
below code is the sample for getting history meetings.
DateTime sdt=DateTime.Parse("07/01/2015");
DateTime edt=DateTime.Parse("07/30/2015");
List<MeetingHistory> historymeets = new System.Collections.Generic.List<MeetingHistory>();
historymeets=meeting.getHistoryMeetings(accesToken, true, sdt, edt);
foreach (var item in historymeets)
{
Console.WriteLine(item.subject);
}
try it out... The above code will store the meetings in historymeets collection object.
You can do the filter function in that collection object.
UPDATE :
List<MeetingHistory> historymeets = new System.Collections.Generic.List<MeetingHistory>();
historymeets=meeting.getHistoryMeetings(accesToken, true, sdt, edt);
List<AttendeeByMeeting> lstAttendee = new System.Collections.Generic.List<AttendeeByMeeting>();
foreach (var item in historymeets)
{
Console.WriteLine(item.meetingId);
lstAttendee=meeting.getAttendeesByMeetings(accesToken, item.meetingId);
foreach (var itemattendee in lstAttendee)
{
Console.WriteLine(itemattendee.attendeeEmail);
}
}
for comment - It is possible, but not directly because there is no api calls, which supports the meeting by attendee . the above code which i have written is for meeting by organizer . Now you have two options,
get the getHistoryMeetings, now you got the meeting details right? , then get the attendees by meeting id using getAttendeesByMeetings(), filter the two different collection objects with join using LINQ. OR
get the meetingdetails and attendees by executing two different fuinction calls, and store it in database or somewhere else, so that you can access it for doing the filter
I am trying to retrieve the default and active card of a Customer. (Also keep in mind that with the coding I have, the customer can always have one card which means if there is a way around it it can help).
Some months ago I used this code segment which was working fine. It seems Stripe made some updates and I can't get it to work now.
current_user.stripe_card_id = customer.active_card.id
The error I get is
undefined method `active_card' for #Stripe::Customer
If you need any more information please let me know.
edit: customer.default_card.id does not work either.
I used customer.methods to check the methods and found this (default_source):
current_user.stripe_card_id = customer.default_source
Works fine now. Thank you
default card id will available in customer object's "default_source" key
{
"id": "cus_GACkqbqFD8RQw4",
"object": "customer",
"default_source": <DEFAULT CARD ID HERE>
...
}
read more here : https://stripe.com/docs/api/customers
[EDIT] Additionally,
It's worth noting that when you request a list of all the cards belonging to a particular customer, the default card is always at the top of the result. So you could also get the default card by requesting the customers cards and adding a limit of 1.
Information on how to achieve this: https://stripe.com/docs/api/cards/list
PaymentMethods API - 2020 update
If you have switched from old Sources API to the new Payment Methods API then you should know that unlike old Sources there's no default Payment Method for a Customer.
Now, you can attach a Payment Method as default one to a subscription object:
Stripe::Subscription.update(
'sub_8epEF0PuRhmltU',
{
default_payment_method: 'pm_1F0c9v2eZvKYlo2CJDeTrB4n',
}
)
or as a customer.invoice_settings.default_payment_method
Stripe::Customer.update(
'cus_FOcc5sbh3ZQpAU',
{
invoice_settings: {default_payment_method: 'pm_1vvc9v2eZvKYlo2CJDeTrB4n'},
}
)
Here is the whole Stripe documentation on that
Relying on customers' default_source is safe no matter the changes. You can see here that subscriptions will still use customers' default_source if both invoice_settings.default_payment_method and subscription.default_payment_method are not set.
customer = Stripe::Customer.retrieve(customer_id_on_stripe)
first_3_cards = customer.sources.all(limit: 3, object: 'card')[:data]
Will return array of cards, if you want to fetch bank_accounts
first_3_bank_accounts = customer.sources.all(limit: 3, object: 'bank_account')[:data]
I've got this problem with Core Data and I don't know where to go with it... Couldn't find any questions similiar to mine so here I am asking you this one:
I've got a Core Data Model where I have a couple of Entities but what's most important there is the central point entity called Activity and other entities are in relation with this one. One of those is Group entity. There is a many-to-many relation between Acitivity and Group tables.
Before I get any Activity from backend I need to select group for which Activities I want. This way I need to fetch and save to the database Groups before anything else - that's fine...
But after saving Groups I need to fetch Activities and each activity has many Groups (which are already in Core Data) and I need to estabilish connection between those.
I assume that I need to fetch all Groups and check them with those which came from Activity and after that I need to find it in Groups entity and add it to Activity?
I must tell you that the scenario I wrote above is far from logical and easy solution that's why I'm concerned about it. Any ideas on how to set this relation between new object and existing ones?
Detailed explanation
When user opens app it has an empty Core Data. So to fill it he has to select some groups and based on this selection application is able to send a request for timetable which consists of Activities. So, if groups are selected, user switches to the timetable view and timetable with activities is downloaded from API. Each activity has also groups in it but I want to use groups that I've already created rather than adding new ones to Core Data.
Take a look at some code examples:
First of all I make a request to API to get all groups and in response I get JSON:
[
{
"id": 507,
"name": "KrDZIs3011Io",
"category": 1,
"category_name": "grupa dziekańska",
"regular": true
},
"..."
]
So I handle this like:
for (id group in responseObject) {
Group *groupEntity = [NSEntityDescription insertNewObjectForEntityForName:#"Group" inManagedObjectContext:tempContext];
groupEntity.name = [group valueForKey:#"name"];
groupEntity.cashID = [group valueForKey:#"id"];
groupEntity.caseInsensitiveName = [[group valueForKey:#"name"] lowercaseString];
groupEntity.selected = #NO;
}
I'll skip the part where I'm checking for duplicates and saving MOC.
After this app is able to fetch groups which user selects (groupEntity.selected = #YES) and based on that create a request for timetable. In response user get something like:
{
"_id":"g552g3328",
"params":{
"group_id":[
552,
3328
]
},
"version":"5096146ca522d316c87b217b83a6c4d2",
"activities":[
{
"id":18282,
"places":[
{
"id":97,
"name":"Paw. C s. A",
"full_name":"Pawilon C sala A",
"regular":true
}
],
"tutors":[
{
"id":266,
"name":"prof. UEK Paweł Lula",
"short_name":"P. Lula",
"moodle_url":"https://e-uczelnia.uek.krakow.pl/course/view.php?id=1034",
"regular":true
}
],
"groups":[
{
"id":552,
"name":"KrDZIs3011Io",
"type":1,
"type_name":"Grupa dziekańska"
},
{
"id":553,
"name":"KrDZIs3011Si",
"type":1,
"type_name":"Grupa dziekańska"
},
{
"id":554,
"name":"KrDZIs3012Si",
"type":1,
"type_name":"Grupa dziekańska"
}
],
"category":1,
"category_name":"wykład",
"name":"Teoria grafów",
"regular_course":true,
"notes":"",
"url":"",
"date":"2014-02-07",
"day_of_week":5,
"day_of_week_text":"Pt",
"starts_at":"9:35",
"ends_at":"14:45",
"regular_schedule":true,
"starts_at_timestamp":1391765400,
"ends_at_timestamp":1391771100,
"unit_ordinal_number":"1",
"unit_total_count":"15",
"canceled":false,
"canceled_reason":""
},
...
]
}
As you can see I have an array of activities and each activity has an array of groups (which already are in Database but not linked).
So here I create new Entity for timetable and new entities for Activities and when I get to the Groups array in Activity how should I link it to the groups I already have in database?