getting unexpected invalid filter.created_at[from] error message - soundcloud

I'm making this kind of SoundCloud API request:
https://api.soundcloud.com/tracks.json?q=electro&limit=10&client_id=<my-client-id-that-I-removed-intentionally>&created_at%5Bfrom%5D=2014%2F11%2F24%2012%3A03%3A04&offset=0
and since recently, I'm getting this response:
code: 400,
body:
{"errors":[{"error_message":"invalid filter.created_at[from] value: '2014/11/24 12:03:04'"}]}
My request should be fine, according to the official documentation:
https://developers.soundcloud.com/docs/api/reference#tracks
Could you please tell me if I'm doing something wrong?
Thanks for the support in advance.

The problem is in the date format. The docs say dashes should be used in dates:
created_at[from] date (yyyy-mm-dd hh:mm:ss) return tracks created at this date or later
So it will work when you specify the date like this: 2014-11-24 12:03:04 (not with slashes).
We at SoundCloud recently changed the behaviour of the API to return errors for all kinds of for invalid input in filters in order to be clearer about what is allowed and what can be expected.

Related

How to reset a date attribute in an object in Maximo REST API

I want to change the deligatefromdate/deligatetodate in the person object in IBM's Maximo REST API.
If I want to set a date I use this request:
POST maximo/rest/mbo/person/12345/?_format=json&delegatefromdate=2020-12-02
My person object then is returned and the value in delegatefromdate is:
"DELEGATEFROMDATE": {
"content": "2020-12-02T00:00:00+01:00"
}
But now I want to remove the date, I dont want a delegatetodate/delegatefromdate.
I have tried:
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=
Value is not changed
POST maximo/rest/mbo/person/63006/?_format=json
Value is not changed
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=null
Error: Error 400: BMXAA4143E - The date format is not valid. Use the date format defined by your locale, or use the calendar control to enter a date.
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=NULL
Error: Error 400: BMXAA4143E - The date format is not valid. Use the date format defined by your locale, or use the calendar control to enter a date.
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=~null~
Error: Error 400: BMXAA4143E - The date format is not valid. Use the date format defined by your locale, or use the calendar control to enter a date.
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=~NULL~
Error: Error 400: BMXAA4143E - The date format is not valid. Use the date format defined by your locale, or use the calendar control to enter a date.
POST maximo/rest/mbo/person/63006/?_format=json&delegatefromdate=0
Date is set to: "2000-12-01T00:00:00+01:00"
I have tried with and without &addchange=
So my question is, how do I clear this date?
In the GUI I just erase the value and save and it is gone.
IBM has a record of this problem as APAR IV93341: UNABLE TO UPDATE FIELD TO NULL THROUGH THE MAXIMO REST API. Someone found it on Maximo 7.5.0.7, and the APAR fix was included in 7.6.0.8.

Linkedin Ads API What's the format of the `dateRange` request parameter?

What's the right format for dateRange for rest-li v2?
The current examples in the documentation do not support it, and I don't understand from the rest-li documentation what's the format for it, exactly.
This is the request I make:
Headers:
X-Restli-Protocol-Version: 2.0.0
Authorization: Bearer <token-here>
URL (with request parameters):
https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&pivot=CAMPAIGN&dateRange.start.day=1&dateRange.start.month=1&dateRange.start.year=2017&timeGranularity=DAILY
OR
URL - deconstructed (with request parameters):
Base URL:https://api.linkedin.com/v2
Params:
q:analytics
pivot:CAMPAIGN
dateRange.start.day:1
dateRange.start.month:1
dateRange.start.year:2017
timeGranularity:DAILY
Error I get:
{
"serviceErrorCode": 100,
"message": "Unpermitted fields present in PARAMETER: Data Processing >Exception while processing fields [/dateRange.start.day, /dateRange.start.month, >/dateRange.start.year]",
"status": 403
}
Note: I'm referred to a question with the same error in the comments, however this might be caused by a different reason, and the answer there does not work for me. If by StackOverflow's standards you still think that it's a duplicate, please let me know and I'll close this question.
The first solution didn't work for me. As Linkedin's API documentation is shit in regards to this it took me a lot of trial and error. #Gal-Grünfeld final structure is correct but the example isn't. Linkedin's docs say the key is dateRange.start which is wrong.
dateRange=(start:(day:1,month:9,year:2020))
Solution provided by one of the LinkedIn developers:
For Restli version 2, for parameter dateRange (tested only for endpoint AnalyticsV2):
rangeDate := (start[,end]) (end is optional)
start, end - type: Date
Date := (day, month, year)
day - type: integer (tested for single digit only)
month - type: integer (tested for single digit only)
year - type: integer (tested for 4 digits only)
Final structure (not including the optional end):
dateRange=(start:(day:,month:,year:))
Example:
dateRange=(start:1,month:1,year:2017)
When you are using Python and requests, the working format of 'dateRange' parameter is:
params = {
'q': 'analytics',
'dateRange.start.day': '1',
'dateRange.start.month': '1',
'dateRange.start.year': '2022',
'pivot': 'COMPANY',
'timeGranularity': 'DAILY'
}
But remember to remove (or not use at all) the header "X-Restli-Protocol-Version"
Be careful about the query parameter encoding, I am using Faraday library for HTTP get requests and it encodes the query string, so I am correctly using the dateRange=(start:(day:1,month:9,year:2020)), but at the end Faraday encodes it to something like this: dateRange%3D%28start%3A%28day%3A1%2Cmonth%3A9%2Cyear%3A2020%29%29. But linkedin expects the first brackets unencoded, I had same problem with other endpoint, where the List(something) was not working, but with curl it was working, the difference is encoding.

Retrieve TSX intra-day quote from Alphavantage

I've been able to get the daily quote for TSX marketing using this endpoint, and it has been working perfectly.
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=TSX:BTO&apikey={{key}}
But when I try to get intraday data (60 minutes) with the following request, it doesn't work.
https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&interval=60min&symbol=TSX:BTO&apikey={{key}}
RESPONSE
{
Error Message: "Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_INTRADAY."
}
Is this because they don't offer intraday data for TSX or did I do anything wrong?
Thanks!
Use symbol=BTO.TO in your URL for both
Longer explanation:
There are a number of different methods for mapping tickers - generally the best method is:
symbol.exchange
See the wiki for more information

Facebook Graph API event-id/comments?since=2014-02-01&until=2014-02-10 , Date filter has no effect

I am trying to bring comments made on a particular event by targeting this URL: https://graph.facebook.com/1466384840257158/comments
I am passing the user_access_token
I have two comments at present on this event made on the same
day(2014-03-29)
Now I try to pass a date which should bring an empty data result/object
like this: https://graph.facebook.com/1466384840257158/comments?since=2011-01-01&until=2014-01-10
This request has no effect, it still shows me the two comment made
on the 29th
I have tried the same kind of date range on my user-id/feed and it
gave me an empty data object.
Finally i tried event-id/feed (before trying date filter) and it
gave me the following error
.
{
"error": {
"message": "An unexpected error has occurred. Please retry your request later.",
"type": "OAuthException",
"code": 2
}
}
Could you please guide me about date filter on that particular query (point4) or if you have any other idea to use date filter on comments made for an event.
Comments use Cursor-based Pagination, so you cannot use since or until on the comments endpoint (these parameters would work f.ex. for the feed endpoint).
To get the comments in a time range you have to fetch all comments from NOW to the start of the time range, f.ex. with https://graph.facebook.com/1466384840257158/comments?filter=stream&limit=1000+paging (the filter=stream will order the result with the timestamp).
USING SINCE UNTIL FOR COMMENTS on GROUP
If you want to use since and until for comments, it is not possible directly for a group. So, First you can apply it for status(feed) and then get the comments for that feed.
This works for me:
{group_id}/?fields=feed.since(08/25/2016).until(08/31/2016){from,comments{from,message}}
Why don't you try first to filter by notifications?... notifications allows you to add parameters like since. For example (using Facebook pages):
https://graph.facebook.com/PAGEID?fields=notifications.since(2015-3-31 00:00:00).limit(250).include_read(true)&{id,created_time,updated_time,unread,object,link}&access_token=ACCESSTOKEN
Once you got the json data, loop through data, get the ID and send a second request but this time using the PAGEID_POSTID edge. Something like this:
https://graph.facebook.com/PAGEID_POSTID/comments?fields=id,from{name,id},message,can_remove,created_time&limit=1000
Voahla!... there's no need to read every comment!...
Note 1: A Page access token is required, along with the manage_pages permission
Note 2: Use the parameter/field include_read to get all the notifications, even the already readed
Note 3: In the second request, use the parameter/field "filter=stream" to order the posts and get the comments made in the name of your page
Note 4: Don't forget to control the asynchronicity once you loop!
Note 5: Notifications duplicate posts, use an array to avoid to read more than one time the postUse the parameter/field include_read to get all the notifications, even the already readed
I do not know if it's too late. But, Yeah it works in the graph api version 3.3.
for example: if you wanna get comments on a post of a Facebook page you can do it like this:
You have to use page Access-token
The get Graph Request : post_id/comments?since=some_date

How to set time_ranges for Ad Report Stats?

https://developers.facebook.com/docs/reference/ads-api/adreportstats/
Based on the documentation
time_ranges Array of timestamp objects {time_start, time_stop} or date objects {day, month, year}.
So in the Graph API Explorer, I am setting the time_ranges value as
time_ranges=[{"day_start":{"day":1,"month":11,"year":2013}},{"day_stop":{"day":10,"month":11,"year":2013}}]
This returns me an error
{
"error": {
"message": "(#100) Please set time_start and time_stop or day_start and day_stop.",
"type": "OAuthException",
"code": 100
}
}
I have removed other part of the above URL for brevity. I have tried with date_preset value and the report returns data.
Thanks.
EDIT: The complete URL (sans the valid account id)
https://graph.facebook.com/act_12345/reportstats?data_columns=["account_id","account_name","campaign_id","campaign_name","impressions","clicks","spend"]&time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}}","{'day_stop':{'day':10,'month':11,'year':2013}}"]
I had (have!) an identical issue.
I worked around it by using time_start and time_stop instead of day_start and day_stop. Stupid, I know... but it's what worked for me.
So to get 1-day's worth of data (the 19th of Nov for example):
&time_ranges=["{'time_start': '2013-11-19','time_stop':'2013-11-20'}"]
Oddly enough, the example appears to be an array of strings that are json objects. So try changing this line:
time_ranges=[{"day_start":{"day":1,"month":11,"year":2013}},{"day_stop":{"day":10,"month":11,"year":2013}}]
to this:
time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}}","{'day_stop':{'day':10,'month':11,'year':2013}}"]
I had the same problem, try using:
time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}, 'day_stop':{'day':10,'month':11,'year':2013}}"]
instead of:
time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}}","{'day_stop':{'day':10,'month':11,'year':2013}}"]
Complete URL:
https://graph.facebook.com/act_12345/reportstats?data_columns=["account_id","account_name","campaign_id","campaign_name","impressions","clicks","spend"]&time_ranges=["{'day_start':{'day':1,'month':11,'year':2013}, 'day_stop':{'day':10,'month':11,'year':2013}}"]
I opened a documentation issue at https://developers.facebook.com/x/bugs/1423346704577387/