How can I content-partner and can-read-video-streams roles from Dailymotion? - dailymotion-api

I try to retrieve an HLS stream URL of my videos on Dailymotion, calling /video/ API with stream_hls_url value in the fields parameter. But I get a 403 error with the following message:
Unsufficient roles for the 'fields' parameter of 'GET /video/<id>' with 'stream_hls_url' value, roles required: content-partner, can-read-video-streams
How could I obtain these roles, given that I'm a Dailymotion partner?

You should either contact your Dailymotion content manager if you have one, or get in touch with us by writing your request to https://faq.dailymotion.com/hc/en/requests/new

Anyone coming to this question with a similar response from an API request; please check the fields you're requesting within your request against those listed in the Dailymotion API Data API Reference.
Often this "403" response, seemingly due to "Unsufficient Roles" (yes that's a typo), is actually down to requesting a field that no longer exists within the defined reference (linked above). This happens more than it should, with little or no notice to the end user - as demonstrated here.
I hope this helps :)

Related

Youtube - ListChannels with Username(forUsername) is not working

I'm trying to get channels info with ChannelsList. This endpoint has a parameter the name is: forUsername but it does not work for this page: https://www.youtube.com/c/FolkartTr
This is my query and it returns empty data:
Somehow, I got this channelID in the page source and its: "channelId":"[UCnS--2e1yzQCm5r4ClrMJBg]".
When I try to query with this ID it's okay and returns with correct data.
and this is its payload: http://jsonblob.com/941253671862419456
How will I be able to reach this channel info using a username? I got a few links with usernames and I want to get their info with their username. I don't have any chance to get their channelID's for all.
Thanks for your help.
If I understood correctly, your problem is that you can't do anything from such a username with the Channels: list of the YouTube Data API v3. If you're just looking for the channel id linked to this username then because as YouTube Data API v3 doesn't work for this, I would recommend you to use my open-source YouTube operational API, indeed by requesting https://yt.lemnoslife.com/channels?part=snippet&forUsername=FolkartTr you'll receive a JSON with id equals to the channel id linked to the provided forUsername value.
If you have any question don't hesitate to comment or come to the Discord support.
Notice that the channel title and the channel customUrl might be different.
In your example - http://jsonblob.com/941253671862419456 -, the channel title is Folkart, but its customUrl - which is the value you get when view on YouTube - is: folkarttr.
Note the difference in both case-sensitive and additional letters.
For these reasons, you should not based your channel search by name, but, rather, by its channel_id.
If you really need to search by userName, the answer from Benjamin Loison can solve your requirement.
See if you can find a ticket on Issue Tracker or post your issue there too. Then, you might get some official answer.

List channel subscriptions returns only my channel

So, I have a request that should list my subscribers who do not have the private subscriptions option enable. My request is:
response = youtube.subscriptions().list(
part="snippet",
maxResults=50,
mySubscribers=True
).execute()
However, in items resource, every channel returned is my own channel. My channel name, ID and profile images. Is this the problem with the API or am I making a wrong request?
I also tried using the Try this API option on the documentation, but it also returns the same result.
https://developers.google.com/youtube/v3/docs/subscriptions/list
Thank you for any help you can give
According to the official docs you already quoted, you should have passed to your API call the parameter part as:
part="snippet,subscriberSnippet".
The subscriberSnippet part gives you the needed info:
subscriberSnippet (object)
The subscriberSnippet object contains basic details about the subscriber.
For what concerns the snippet part, the official doc is indeed a bit ambiguous:
snippet (object)
The snippet object contains basic details about the subscription, including its title and the channel that the user subscribed to.
Nevertheless, the info you get from part="snippet" only is correct.

How to get to invoice link in invoices api

I am interested to have a invoice link/pdf from the api which returns the invoice using new freshbooks api endpoint https://api.freshbooks.com/accounting/account/<accountid>/invoices/<invoiceid>
Even including direct_links I am unable to get the link to the invoice. With direct_links it returns json with fields id, contactid, created_date, type, userid, objectid, token.
I currently work at FreshBooks.
Unfortunately these direct link tokens will only work with old FreshBooks, which isn't mentioned in the documentation -- I'll see if we can fix that.
Poking through, it doesn't look like we've has exposed a way to access a PDF version of the invoice through the public API just yet. But I'll pass that on to the appropriate channels and I'll update this answer if that changes.

Post update to Buffer API error - "Please select at least one account to post from"

I'm extending an app to include semi automatic posting to social media using the Buffer API. I'm having trouble posting the update to Buffer.
Using Postman to play around with the API, everything is authenticated successfully and I'm able to GET anything I need, however, I keep getting the error "Please select at least one account to post from" returned when trying to POST an update.
After adding the required params to postman, I have the following request URL, which fails:
https://api.bufferapp.com/1/updates/create.json?pretty=true&access_token=1/XXXXXXXXXXXXX&profile_ids[]=XXXXXXXXXXXX&text=This is an update
After reading this twitter thread, I have also tried the following with no luck:
https://api.bufferapp.com/1/updates/create.json?pretty=true&access_token=1/XXXXXXXXXXXXX&profile_ids%5B%5D=XXXXXXXXXXXX&text=This is an update
The full error / response is:
{
"success": false,
"message": "Please select at least one account to post from.",
"code": 1004
}
The related documentation is here.
What am I overlooking? I have a sneaking suspicion that it's something simple I'm not seeing.
Any help is much appreciated :)
Have you tried putting the POST data in the body of the request, rather than the URL? e.g:
HTTP/POST https://api.bufferapp.com/1/updates/create.json
Content-Type: application/x-www-form-urlencoded
pretty=true&access_token=1/XXXXXXXXXXXXX&profile_ids[]=XXXXXXXXXXXX&text=This is an update

Getting Invalid Token response when trying to create D2L user account

I am trying to modify a D2L database from within a 3rd party application using their Valence API. I've gotten some operations to work but am stuck trying to create a new user account. I have been told that the account I am working under is authorized to do this.
I’ve defined a JSON object to hold the values I want:
{
"OrgDefinedId": "XX000TEST",
"FirstName": "Tom",
"MiddleName": "",
"LastName": "Foolery",
"ExternalEmail": "tom#something.com",
"UserName": "Tom.Foolery",
"RoleId": "78",
"IsActive": "true",
"SendCreationEmail": "false"
}
I copied the above text to the HTTP post buffer and then called the following link:
/d2l/api/lp/1.0/users/?
The parameter string contains the IDs and signatures (x_a, x_b, etc) as specified in the Valence docs. I assume the authorization values are correct, since I'm getting correct results when using the same algorithms on other Valence queries.
Any suggestions on how to get past the "Invalid Token" message would be appreciated.
--stein
If you're getting a 403 "Invalid Token" message then you are not, for some reason, forming your x_a, x_b, x_c, or x_d authentication tokens correctly. Common problems we have seen in the past are:
Trying to re-use x_c and or x_d signatures generated for one API call with another
Getting the tokens swapped around: x_a is App ID, x_c is App Sig, x_b is User ID, and x_d is User Sig
Generating the signatures using the wrong HTTP method (the method is one of the components of the base string for the signatures)
Not using all upper case letters for the HTTP method in the base string (the component should be GET not get)
Not using all lower case letters for the API route in the base string, or including incorrect characters: for example, in your question, you seem to imply that you're passing in the ? as a part of the route; you shouldn't do this. In this case, your base string for creating the URL should be POST&/d2l/api/lp/1.0/users/&1234567 where 1234567 should be replaced with the timestamp you generate and also pass in x_t
Using the API route with API version component provided, but when calling, using another version component (i.e. generating with /d2l/api/lp/1.0/... but calling with /d2l/api/lp/1.1/...)
Using an incorrect/mismatching timestamp value in the base string (the timestamp you use for the basestring should be in seconds, and be the same stamp as the x_t value)
While calls previously worked, suddenly none of the calls work with a 403 invalid token result: the user tokens could have expired and you need to re-authenticate the user
While calls previously worked against a test instance, when you try moving to a different LMS (prod instance for example) the calls don't work: perhaps the App ID/Key pair hasn't shown up on this new LMS, or you're trying to use the user ID/Key pair from one LMS to generate signatures on a different LMS
Also, notice that your JSON object is strictly not correctly formed: the IsActive and SendCreationEmail properties should have values of true and false respectively, not "true" and "false", although it's possible that the LMS parser on the server side will be forgiving about that.
If none of these points assist you, please feel free to open an issue in our issue tracker, or contact our Valence support email address, and we can try to help you out through this issue.
NOTE Please note that invalid tokens will throw you back a 403 (but the message will be "Invalid Token" or "Expired Token" or similar). If your tokens are correctly generated, but your calling user context is not allowed to create a user, then you'll also get a 403, but this time the message will be "Not Permitted" or "Not Authorized" or similar. Make sure you double check what sort of 403 you're getting back.
In this particular case, the permissions around creating a user are a bit tricky; not only must you have a permission to create a user, you must also have permission to modify the properties that you will be passing into the API in the CreateUserData structure (OrgDefinedId, Email, and so on), and you must also be able to see all those fields in the User Information Privacy settings, and you must have permission to enroll the user role you have provided at the organization level... those last two bits have tripped up some of our clients in the past.

Resources