eBay Finding API get completed listings sort by whether ended with sales - ebay-api

Trying to get completed listings with sales from eBay API. I can get the list of all 'ended listings', however, having troubles determining, whether the listing had any sales. What I am currently using to determine it is
item->sellingStatus->sellingState;
even though according to eBay API documentation that is exactly what I need, the response never matches manual search on eBay..
If an item is listed as good til cancelled and it had sales, but is still running (and will be running continuously), the response for this listing is EndedWithoutSales, which makes no sense - first of all, it is not ended yet, second of all, it already had sales..
What I need is a reliable way to sort completed listings into those listings, which had at least one sale (regardless whether the listing is still running as good til cancelled or already ended) and those listings, which ended with no sales.
Any ideas?

I am using GetMyeBaySellingRequest to get my sale numbers i.e last 24 hours ended listings which are sold.
<SellingSummary><Include>TRUE</Include></SellingSummary>
<SoldList>
<DurationInDays>1</DurationInDays>
<OrderStatusFilter>All</OrderStatusFilter>
<Pagination>
<EntriesPerPage>100</EntriesPerPage>
<PageNumber>1</PageNumber>
</Pagination>
</SoldList>
Hence under the SellingSummary part i received all the required data. Here [TotalSoldCount] depends on the SoldList > DurationInDays.
[ActiveAuctionCount] => 56
[AuctionSellingCount] => 13697
[AuctionBidCount] => 59
[TotalAuctionSellingValue] => 724.44
[TotalSoldCount] => 32
[TotalSoldValue] => 477.97
[SoldDurationInDays] => 1
[ClassifiedAdCount] => 0
[TotalLeadCount] => 0
[ClassifiedAdOfferCount] => 0
[TotalListingsWithLeads] => 0
[QuantityLimitRemaining] => 54852
[AmountLimitRemaining] => 4.845525842E7
Hope it helps.

Related

Shopify API - Can't find orders created by another application

I'm trying to find all of my store's orders, and found out that I can only received list of manually created orders, but not orders created by another applications throughout APIs.
Here my current orders list:
And here my code to find all orders
temp = ShopifyAPI::Order.find(:all, :params=>{:status => 'any', :fields => 'name'})
or find single order with order_id
order = ShopifyAPI::Order.find(show_params['order_id'])
The 1st line of code return only 1 order (#1013) created by me
[#<ShopifyAPI::Order:0x0000000c6ae170 #attributes={"name"=>"#1013"}, #prefix_options={}, #persisted=true>]
The 2nd line of code raised error:
#<ActiveResource::ResourceNotFound: Failed. Response code = 404. Response message = Not Found (Not Found).>
Note that all of my other orders except #1013 created by 3rd-application:
What should I do now to find all my orders?
Thank in advance.
P/s: I use 2020-01 api version.
By default, read_orders scope grants you access to get orders created not earlier than 60 days ago.
You have to request read_all_orders scope to be able to fetch all orders now.

Get all applications in Podio

I would like to get all apps which are accessible to me. So I used the API
https://developers.podio.com/doc/applications/get-all-apps-5902728
There is a 'limit' parameter but there is no 'offset' parameter.
The max value of limit is 100.
Is there any other method to get all apps?
Any help will be appreciated.
You can still go through hierarchy Org => Space => App => Item
Get all organisations, which will also give all spaces
https://developers.podio.com/doc/organizations/get-organizations-22344
Get all apps per space
https://developers.podio.com/doc/applications/get-apps-by-space-22478
Small example in Ruby demonstrating how it works
orgs = Podio::Organization.find_all()
orgs.each do |org|
org.spaces.each do |space|
puts "Working in space id:#{space['space_id']} name:'#{space['name']}'"
apps = Podio::Application.find_all_for_space(space['space_id'])
apps.each do |app|
puts "\tApp id:#{app['app_id']} name:'#{app['config']['name']}'"
end
end
end

Query problems with Twitter search API

I'm building Twitter Search API query based on their instructions here and here.
The query is working fine if I use the exact examples of the instructions above, like if I send the query like this: q=%23superbowl&result_type=recent, it would give me as many answers I'd like to get
BUT
if I would try to search for hashtag jäniksenvuosi (which I know to be tweeted many times), I would only get one answer and that answer is my own latest tweet. Nothing else.
I tried it with other Finnish words with umlauts too, but those work properly, so it is not about umlauts either.
Question in short
What's the difference between these two and how do I fix this?
Working: q=%23superbowl&result_type=recent
Not working: q=%23j%C3%A4niksenvuosi&result_type=recent
Search metadata
superbowl:
[search_metadata] => Array
(
[completed_in] => 0.075
[max_id] => 688984569614327808
[max_id_str] => 688984569614327808
[next_results] => ?max_id=688976241051873280&q=%23superbowl&count=30&include_entities=1&result_type=recent
[query] => %23superbowl
[refresh_url] => ?since_id=688984569614327808&q=%23superbowl&result_type=recent&include_entities=1
[count] => 30
[since_id] => 0
[since_id_str] => 0
)
jäniksenvuosi
[search_metadata] => Array
(
[completed_in] => 0.052
[max_id] => 688984569614327808
[max_id_str] => 688984569614327808
[query] => %23j%C3%A4niksenvuosi
[refresh_url] => ?since_id=688984569614327808&q=%23j%C3%A4niksenvuosi&result_type=recent&include_entities=1
[count] => 30
[since_id] => 0
[since_id_str] => 0
)
Just tried this using twurl, and I currently get three results for that hashtag (#jäniksenvuosi).
This is consistent with what I'd expect. On the Twitter website, there are three Tweets returned that contained that hashtag during January. The previous occurrence was in December.
Twitter's Search API has access to an index of Tweets covering approximately 7 days, and it is optimised for recency rather than completeness (see this page in the developer documentation)

How to get charges(transactions) details in Stripe based on date range

I wanted to get a list of charges(Transactions) based on date range I specify, ie all transactions between my specified Start date and End date.
But in CHARGES API, I can not see any Start date nor End Date arguments.
How can I get this?
Had a chat with Stripe staffs through online chat, and found that there is a way to get list of charges based on date range.
Stripe Charges API actually has some argument that are not yet listed in their documentation.
Arguments like created[lte] and created[gte] with Unix timestamp can be used, just like Events API call.
EG: https://api.stripe.com/v1/charges?created[gte]=1362171974&created[lte]=1362517574
Try this one. It's working for me
$pcharges = Charge::all(
array(
'limit' => 100,
'created' => array(
'gte' => strtotime('-15 day'),
'lte' => strtotime('-1 day')
)
)
);
This will return last 15 days data excluding today's transaction. You can set your custom date range as per your requirement.
Here's a Ruby based hack
Stripe.api_key = ENV['STRIPE_SECRET']
stripe_charges = []
first_charge = Stripe::Charge.all(limit: 1).data[0].id
charge_index = first_charge
*a lot of*.times do
new_charges = Stripe::Charge.all(limit: 100, starting_after: charge_index).data
stripe_charges << new_charges
charge_index = new_charges.last.id
stripe_charges.flatten!
end
Was looking in to it today and here is what i found
https://stripe.com/docs/api/curl#list_charges
curl https://api.stripe.com/v1/charges?limit=3 \
-u sk_test_BQokikJOvBiI2HlWgH4olfQ2:
This is stripes curl example there are more examples on their website.
-James Harrington
In case anyone is using Ruby on Rails and is looking for a solution to list out all refunds that's been created after a Unix timestamp, using the created.gte syntax, here's a working example for me that I got from Stripe Support.
Stripe::Refund.list({limit: 100, created: {gte: 1614045880}})
You can change that Unix timestamp to fit your situation.
Resources: Stripe API Reference, List all refunds and Stripe Support
To get particular date data code is like
$mydata= \Stripe\Charge::all(array('limit'=>50,'starting_after'=>null ,"created" => array("gt" => strtotime("2020-02-17"),"lt" => strtotime("2020-02-19"))));
print_r($mydata);
It will give you data of 2020-02-18 with limit 50, If you want more record add last charge id in starting_after parameter

Grouping items into first occurances

I totally can't get my head around writing a correct query for my problem this morning so here's hoping that someone out there can help me out.
I have a database table called Sessions which basically looks like this
Sessions:
SessionID
SessionStarted
IPAddress
..other meta data..
I have a requirement where I am to show how many new Sessions (where new is defined as from a previously unseen IPAddress) arrive each day over a given period. Basically, each IPAddress should count only once in the results, namely for the day of the first session from the IPAddress. So I'm looking for a result like:
[Date] [New]
2009-10-01 : 11
2009-10-02 : 6
2009-10-03 : 19
..and so on
...which I can plot on some nice chart and show to important people. I would very much prefer a Linq2SQL query as that is what we are currently using for data access, but if I'm out of luck I may be able to go with some raw SQL (accessed via stored procedure, but I would really, really, really prefer Linq2SQL).
(As a bonus my next step will very likely be qualifying which sessions should be included by filtering on some of the other meta data)
Hoping that someone clever will help me out here...
I would use something like this.
var result = data.OrderBy(x => x.SessionStarted)
.GroupBy(x => x.IPAddress)
.Select(x => x.First())
.GroupBy(x => x.SessionStarted.Date)
.Select(x => new { Date = x.Key, New = x.Count() });