I was using the following code in the terminal to search for all the tweets in the given conversation:
curl --request GET \
--url 'https://api.twitter.com/2/tweets/search/recent?query=conversation_id:107679773517545473&tweet.fields=in_reply_to_user_id,author_id,created_at,conversation_id' \
--header 'Authorization: Bearer $bearertoken'
But I got the following result(I also tried conversation id from twitter's example 1279940000004973111 with the same result)
{"meta":{"result_count":0}
I don't know why.Is that because I don't have an academic license?
/recent only gives you tweets that are less than 1 week old. That means, even if you have multiple tweets with same conversation id, you only get tweets that are less than 1 week old. That is why you are getting {"meta":{"result_count":0}. Probably you will need to have academic access. Haven't found any other ways to get old tweets on Internet.
Related
I have been trying to figure out the sonos api over the past few days, but unfortuanetly have hit a road block. I have already gotten my tokens and room names and and favorites Id, but when I send the curl request to play a song I get the error described above.
Curl Code :
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer {TOKEN}" "https://api.ws.sonos.com/control/api/v1/groups/RINCON_48A6B88A5B14014XX:XXXXXXXXXX/favorites" --data #play.json
I keep the body in a .json file called play which contains the code:
{
"favoriteId":2,
"playOnCompletion":true
}
I have not been able to find any documentation on this issue online, so any and all help is very appreciated.
The "ERROR_RESOURCE_GONE" HTTP 410 response indicates that the
groupID you are using in your request (RINCON_48A6B88A5B14014XX:XXXXXXXXXX) no longer exists. Group IDs are not static and may change depending on a number of factors - grouping and ungrouping, power cycling, etc.
If you re-run the request to get groups, you should get an up-to-date list of group IDs. Try doing that and using a returned Group ID in your favorites request.
The "Subscribe" section of the documentation describes how to automatically listen for group ID changes: https://developer.sonos.com/build/direct-control/connect/
Have you made sure that the groupId or the favoriteId are still valid? Based on the ERROR_RESOURCE_GONE, it seems one of those has likely changed.
I'm doing a script that takes a video ID from Vimeo, calls the API and populate the database with all the data we need.
I'm able to get all the fields and everything is working well using that url:
https://api.vimeo.com/videos/{video_id}
I can also use the query ?fields=name, etc... To only get the fields i need.
But when i make that request to the API (even when i use the fields query), the categories array is empty and the credits are returned as this:
"credits": {
"uri": "/videos/{video_id}/credits",
"options": [
"GET",
"POST"
],
"total": 1
}
If i make another request, to those url:
https://api.vimeo.com/videos/{video_id}/credits
https://api.vimeo.com/videos/{video_id}/categories
I get all the info i need about the credits and categories.
The problem is: i do not want to make 3 request to the API to get everything i need. Why are the credits and categories not included in the original video request?
Is there a way i can do it with one call?
Regarding categories, the video may not be categorized, either by the video owner or a Vimeo Curator. When a video has not been categorized, the categories array will return empty.
For example, this test video returns no categories:
curl -X GET
'https://api.vimeo.com/videos/76979871?fields=uri,categories'
-H 'Accept: application/vnd.vimeo.*+json;version=3.4'
-H 'Authorization: bearer [token]'
While this Staff Picked video returns several categories and subcategories:
curl -X GET
'https://api.vimeo.com/videos/274849065?fields=uri,categories.uri,categories.uri,categories.name,categories.top_level'
-H 'Accept: application/vnd.vimeo.*+json;version=3.4'
-H 'Authorization: bearer [token]'
Regarding credits, a video will always have a minimum of one credit (the video owner). I suggest adding some logic so that if metadata.connections.credits.total is greater than 1, then make the additional request to get those other credited users.
For instance, this same Staff Picked video returns metadata.connections.credits.total=2, so to get the additional credited user, you'll need to make a request to the video's credits endpoint.
curl -X GET
'https://api.vimeo.com/videos/274849065?fields=uri,metadata.connections.credits'
-H 'Accept: application/vnd.vimeo.*+json;version=3.4'
-H 'Authorization: bearer [token]'
The reason for the separate endpoint for credits is that each user object can contain a lot of metadata -- if a video credits many users, the video response (which is already quite large) can be even bigger if the fields parameter isn't used.
I hope this information helps!
Im working with an API, where I need to GET a specific Invoice.
To get all Invoices, the Documentation of the Service says:
https://api.domain.com/v1/Invoices - This works like a charm.
So to get a specific Invoice, the Documentation says:
https://api.domain.com/v1/Invoices({Id}) - Doesn't work.
I am working with curl, so my Code is:
curl --header "Authorization:Bearer uh12iuh9ihihshu991u3"-X GET https://api.domain.com/v1/IncomingInvoices
uh12iuh9ihihshu991u3 is a Token.
I don't know how to get a specific Invoice, when ID = 1.
I tried:
- https://api.domain.com/v1/Invoices=1
- https://api.domain.com/v1/Invoices1
All are giving me Errors.
Thanks in Advance.
It it possible to get a list of all the photos or photo IDs by a specific user on Unsplash using the Unsplash API?
According to their API documentation it should be possible:
https://unsplash.com/documentation#list-a-users-photos
You can do that by sending an XHR GET request to their API url:
GET /users/:username/photos
In addition, you can use the parameters page and per_page to increase/decrease the number of photos returned in the request, and therefore, get all the photos of that specific user within one request. I do not see in their documentation an established hard limit on the number of items per_page, which by default is 10.
Actually per_page is limited to 30.
This would be my answer on here (I've been working with this on PowerShell)
I've created a script to get a bearer token that can be read in here:
https://github.com/j0rt3g4/MyTechNetScript/blob/master/TechNet/Unsplash/Do-Oauth20forUnsplash.md#Create-an-account-on-unsplash
and here:
https://medium.com/#josegabrielortegac/how-to-fix-capture-one-software-c3e59b2924da
and downloaded here:
https://gallery.technet.microsoft.com/scriptcenter/Get-Bearer-Token-to-use-360f9ae2
or here (because TechNet would be closing soon)
https://github.com/j0rt3g4/MyTechNetScript/blob/master/TechNet/Unsplash/Do-Oauth20forUnsplash.ps1
my solution for this is after getting the Bearer token from the script, you can use it on any app because that particular token never expires. you'd need just to add the "Authorization", "Bearer Token" header, where token should be changed by the value received by the script and after that, you can just get the count:
Total Number of pictures / 30 (images per page)
In my case my account has right now 750 pictures so that number gives = 25.
and run this:
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization","Bearer <beater token value>")
for($i=1; $i -lt 25;$i++){
$obj+= Invoke-WebRequest -Uri "https://api.unsplash.com/users/j0rt/photos?per_page=30&page=$i&order_by=latest&stats=true" -Headers $headers | select -ExpandProperty Content | ConvertFrom-Json # | select Downloads,Views,Likes
}
How can I get all the toot IDs that I've tooted?
I want to delete all of my toots (status posts) at Mastodon but can't get all the toots.
It would be easier if I delete my account, though I want to keep my account alive and clean up all the mess that my NEWS-BOT did.
It seems that currently, Mastodon doesn't have the ability to delete all the toots as a standard feature.
So I tried to delete them using the Mastodon API recursively as below, but couldn't get all the Toot IDs (Status IDs) for deletion.
GET Toot IDs from /api/v1/timelines/home endpoint.
curl -X GET --header 'Authorization: Bearer <ACCESS_TOKEN>' -sS https://sample.com/api/v1/timelines/home
DELETE a toot at /api/v1/statuses endpoint with Toot IDs that I got.
curl -X DELETE --header 'Authorization: Bearer <ACCESS_TOKEN>' -sS https://sample.com/api/v1/statuses/<Toot ID>
Loop 2 then 1 until empty.
It cleaned up the home timeline. But many toots were left on the public profile page. I also tried to get the IDs from the ATOM feed but didn't help.
All I need is the list of my Statuses IDs that I'd tooted. Any ideas?
Current Conclution
As of #unarist's advice,
API endpoint
https://sample.com/api/v1/accounts/<account id>/statuses
GET /api/v1/accounts/:id/statuses
will do the fetching.
Though, there are 3 points to be noted:
By default, this API method gives you only 20 status(toot info) and max 40.
Authorized API request are limited to 300 requests / 5min (1 request/sec).
Therefore, you can delete NO more than 84,240 toots/day.
It seems that I had over requested and couldn't get the info I needed. So better be careful about the server's message! (>_<)/
Have a good Mastodon time!
Home timeline contains not only your posts but also posts from your followings, and the server only keeps recent posts (400 items by default) of each home timeline. Therefore, you cannot enumerate all your posts from it.
Use account statuses API with your account id:
https://sample.com/api/v1/accounts​/<account id>/statuses
This API is what WebUI uses on your profile page (/web/accounts/xxx).