Getting the list of sponsors - youtube-data-api

I'm working with a Youtuber with over 1mil subscribers and we need to fetch the list of sponsors when users log-in to check if they're sponsoring the channel, if they do they get access to a specific part of the website.
I went through the API docs and couldn't find a way to do it,
am I missing something?
thank you for your help in advance :)

Youtube Data API has Members resource that returns the list of members (sponsors) of a channel. It also returns membership level of each member.
curl \
'https://www.googleapis.com/youtube/v3/members?part=snippet&mode=all_current&maxResults=1000&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
EDIT: Updated answer to Members resource instead of Sponsor resource (deprecated as of 2020-03-31)

Related

Insomnia configure OAuth 2.0 grant_type password access token for other API calls

I am trying to embed OAuth 2.0 grant_type password access token to my insomnia client API calls but getting "Failed to fetch token url= state us=0"
When we try below curl command its returning the access token. each time we have to copy access token and add it as header in insomnia rest call (Their is no client secret as it not confidential).
curl --request POST \
--url https://mydomain/auth/realms/my-app/protocol/openid-connect/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data client_id=myclientid \
--data username=app.admin \
--data 'password=password!' \
--data grant_type=password
Above curl if you create in insomnia client as POST request that is also working only thing is we need to copy and paste as header in other API calls
NOTE: the same is working in postman rest client through pre-request script but I want it to be achieved in insomnia client
After doing lot of research found out the solution by myself
follow this blog https://www.ankursheel.com/blog/automatically-set-access-token-authenticated-requests-insomnia
You need to create separate Generate token request, and set the bearer token in the API request where you want to embed Auth token automatically, click on the Bearer tab and enter Response ⇒ Body Attribute for the token and follow those instruction it worked for me :)

Exporting and Importing Applications From VBCS With REST Calls

Ref - https://support.oracle.com/cloud/faces/DocumentDisplay?id=2637471.1&_adf.ctrl-state=h87zqwsi3_730&_afrLoop=213040896345615
Can anybody help with a sample payload to invoke 'Import Applications' POST method to programmatically import the application to the Oracle Visual Builder Cloud Service.
I know I don't have the Content-Type or the request body or both not correct. I'm using Postman to test the endpoint
Steps
Setup the Oracle Visual Builder Cloud Service instance in https://cloud.oracle.com/?region=
Created an 'Visual Builder' instance in oracle cloud for my login/ tenancy
Launched the VBCS home page and created one or more applications
Used the VBCS REST endpoint (GET /resources/application/exportresources/{projectid}-{version}) to export one of the applications
I'm trying to import the application (POST /resources/application/importresources) to another VBCS instance but unable to determine the correct 'Content-Type' or the request payload format. I keep getting HTTP 415 or 400 error
Code shown below. SERVICENAME-CLOUDACCOUNT.SERVICETYPE is replaced from oracle cloud account.
curl --location --request POST 'https://SERVICENAME-CLOUDACCOUNT.SERVICETYPE.ocp.oraclecloud.com/ic/builder/resources/application/importresources' \
--header 'Authorization: Bearer yourOAuthToken' \
--header 'Content-Type: application/vnd.oracle.adf.error+json;application/json;application/vnd.oracle.adf.resourceitem+json;application/vnd.oracle.adf.resourcecollection+json' \
--header 'REST-Framework-Version: 4' \
--data-raw '{
"branchId": "0",
"importMode": "xyz",
"name": "Test",
"description": "sample",
"location": null,
"fileName": "abc",
"unzip": null
}'
Instead of hacking your way around - how about using the proper way of storing your code in a Git repo and then using the CI/CD features of VB Studio to move your app from one instance to the other?
This will also make upgrades of the app simpler going forward.
Here is an intro:
https://blogs.oracle.com/vbcs/post/automate-visual-applications-cicd-with-visual-builder-studio
I debugged the visual builder cloud instance logs to find the details of the rest api call. When importing the application from the front end ( OVBCS development platform UI ), the logic utilizes the 'Import Applications' endpoint.
Here is the working curl script for importing application resources to the oracle visual builder cloud instance using the REST end points
Login to Oracle Cloud using your cloud account credentials and tenancy
On navigation menu on top left -> OCI Classic Services -> Platform Services -> Visual Builder
Create an instance if you don't have one already. Click on the active instance and Start it up
Grab your VBCS instance base url. It will be something like https://yourInstanceName-yourTenancy.builder.ocp.oraclecloud.com/ic/builder/
Assuming you have a visual application created in your VBCS instance. Ref here
Assuming you are familiar with generating bearer token for oracle cloud applications. The OAuthToken mentioned in the below samples are generated based on your preferred OAuthType ( ResourceOwner or JWT or whatever setup you have for your cloud application)
Export your application. response will be zip file contents. save it to your file system
curl --location --request GET 'https://yourInstanceName-yourTenancy.builder.ocp.oraclecloud.com/ic/builder/resources/application/exportresources/yourAppId-yourAppVersion' --header 'Authorization: Bearer OAuthToken'
Let's say you saved the exported file in C:\temp\yourAppId-yourAppVersion.zip
Import your application as new application in the target instance
curl --location --request POST 'https://yourInstanceName-yourTenancy.builder.ocp.oraclecloud.com/ic/builder/resources/application/importresources?branchId=yourAppId&importMode=CREATE_NEW_APP&name=yourAppName&description=SomeOptionalDesc&fileName=yourAppId-yourAppVersion.zip&unzip=true' --header 'Authorization: Bearer OAuthToken' --header 'Content-Type: application/zip' --data-binary '#/C:/temp/yourAppId-yourAppVersion.zip'
Import your application to an existing application in the target instance. It will override the existing application version with the contents that you are importing.
curl --location --request POST 'https://yourInstanceName-yourTenancy.builder.ocp.oraclecloud.com/ic/builder/resources/application/importresources?branchId=yourAppId-yourAppVersion&importMode=KEEP_EXISTING&name=YourAppName&description=SomeOptionalDesc&fileName=yourAppId-yourAppVersion.zip&unzip=true' --header 'Authorization: Bearer OAuthToken' --header 'Content-Type: application/zip' --data-binary '#/C:/temp/yourAppId-yourAppVersion.zip'

Why does my SuiteQL POST request work when I use Postman, but when I cURL the same code in VS Code terminal, it returns 'INVALID_LOGIN'

I'm trying to use SuiteQL to query a workbook for a client implementation, but I'm having trouble getting it to work in VS Code. I downloaded the Postman environment template and collections archive from the SuiteTalk tools download page and then sent a test request. It returned a successful JSON response. I then tried to send the same sample request using cURL in the VS Code terminal, then with node-fetch, and then using an npm library called netsuite-rest. All of these return 401 'INVALID_LOGIN'. Why does it work when I use Postman, but nowhere else? Here's a sample of my cURL request:
curl --location --request POST 'https://<ACCOUNT_ID>.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=5' \
--header 'prefer: transient' \
--header 'Content-Type: application/json' \
--header 'Authorization: OAuth realm="<ACCOUNT_ID>",oauth_consumer_key="<CONSUMER_KEY>",oauth_token="<TOKEN>",oauth_signature_method="HMAC-SHA256",oauth_timestamp="<TIMESTAMP>",oauth_nonce="<NONCE>",oauth_version="1.0",oauth_signature="<SIGNATURE>"' \
--header 'Cookie: NS_ROUTING_VERSION=LAGGING' \
--data-raw '{
"q": "SELECT id, companyName, email, dateCreated FROM customer WHERE dateCreated >= '\''01/01/2019'\'' AND dateCreated < '\''01/01/2020'\''"
}'
I see this is an old thread however, I myself am just getting started with NetSuite and Postman. For me, the netsuite Postman query will work fine when you get your access token and this will work for a short period of time. Eventually it will fail and at that time you need to use your refresh token to get a new access token. Then, add the fresh access token into your query authorization as a bearer token - and then the query will start working again.
Once it is actively working then there is a magic Area of postman = Code Snippet. So click on that and then notice that there is a pulldown menu of many code bases - that will display the entire code request for your query! For example you could choose nodeJS - Axios - and just copy the code and paste it in to your webpage.
The one thing you will have to remember is that the access token Will expire after a period of time and then you will have to replace the access token with a fresh one (using the refresh token).

Mailchimp API: Unable to trigger Events with umlauts in properties

I’m using the Mailchimp Events API to trigger events on the members in our Audience list. In general the API works as expected: When I send an event, I can see the event's name and properties in the member’s activity.
However, if any of the properties in the Event contain German umlauts, it doesn’t work. It records the event on the member but without the properties.
For example: When the event is triggered as follows:
curl --location --request POST 'https://us4.api.mailchimp.com/3.0/lists/1234/members/12343124/events' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'Authorization: Basic TED' \
--data-raw '{
"name": "test-event",
"properties": {
"link": "Münich"
}
}'
The event is records under the member's activity but without the properties.
Hope someone could help me out with this.
Thanks in advance.
Turns out Mailchimp Event API endpoints don't support it.
This was the response from Mailchimp API's support team:
Currently, using special characters in data passed over in relation to the Events endpoint is not supported. Our developers are aware and we're tracking feedback as a fix is in the works. I don't have a current ETA for that, unfortunately. The best option at this time is the avoid using special characters whenever possible, and please send any specific occurrences of this that you see our way so we can add them to our tracking.

PARSE API Push Notifications with Embedded C

I was able to successfully follow the Embedded C guide to set up my device with the PARSE API and send a test push to it, but I'm having an issue registering the device for custom push notifications. When I go to the Push page and try to "Send a push" I get a message saying "No Registered Devices". I assume that this has to do with the fact that the device does not register to any channels using the provided sample code. The API documentation lacks severely on the ParseClient class and therefore I am left wondering how one would achieve this?
Can the parseSendRequest function be used to modify fields in the Installation class?
The goal here is to be able to send custom push notifications to the said device, any sample code would be greatly appreciated.
Thanks!
After some trial and error this seemed to work for me to send non-targetted pushes like the button on the getting started page:
curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceType": "embedded"
},
"data": {
"alert": "Hello World!"
}
}' https://api.parse.com/1/push
It does not quite answer your question of how to properly register the device but you can at least send custom push notifications.

Resources