In the Twilio documentation for the REST API for Media Streams, it says the Media Stream can be stopped with a name, but I can't quite figure out how or am I reading to much into the documentation.
Is it possible that the documentation is only relevant when using TwiML to stop the Media Stream and not the API and thus you have have use the Media Stream SID for the API?
<Stop>
<Stream name="my_first_stream" />
</Stop>
The example code in the docs is using the Media Steam SID only:
Stop Media Stream - Example in docs:
client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.streams('MZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.update({status: 'stopped'})
.then(stream => console.log(stream.name));
Works the same for interacting with Conference resource friendly names; use the resource URL; e.g.
https://api.twilio.com/2010-04-01/Accounts/{{account_sid}}/Calls/{{call_sid}}/Streams/{{stream_name}}.json
Where {{stream_name}} is the, well, stream name.
I am sure I have seen other APIs that allow you to specify a name or a SID when referring to the resource but I cannot find an example (so maybe I'm wrong).
This is a bit ambiguous here though. But, comments in the Node library suggest you can use a name or sid when constructing a stream:
#param {sid_like} sid - The SID of the Stream resource, or the `name`
And since those comments are derived from the API definitions, I believe that you can use the name in a REST API call too.
Related
I'm using the Twilio Voice API to create an outbound call:
$call = $twilio->calls->create(
"+14155551212", // to
"+15017122661", // from
array(
"url" => "http://demo.twilio.com/docs/voice.xml"
)
);
As you can see, the script used for the call is accessed with the "url" parameter pointing to a XML file.
The XML is hard coded though. Is there a way to write "inline" TwiML inside this create function so I can pass in PHP directly to make the script dynamic? Then I wouldnt be using a hard coded XML file but dynamic PHP instead.
For example, if I have:
$customer_name = $customer['name'];
I'd like to be able to pass this into the script to be read when a listens to the call.
How can I accomplish this?
Twilio developer evangelist here.
There is currently not a way to create a call and directly give it static TwiML to execute.
If you don't want to host static TwiML you could choose to host your TwiML in Twilio's TwiML Bins.
If you want the TwiML to be dynamic, but you don't want to host it yourself, you could use Twilio Functions to respond to your webhook.
Let me know if that helps at all.
Every URL ends with the same pattern, "Part-123456789" where the "Part" is a constant and the "123456789" is a part number. I want to run an adwords campaign targetting every part # and directing to the unique url for that part. Is there a simple way to do this?
Note: Adwords Editor is giving me ambiguous rowtype errors whenever I try to upload the keywords and URL's together in the same line of a .csv file.
The available value track parameters for AdWords tracking templates offers both the keyword ID and matched keyword:
https://support.google.com/adwords/answer/6305348?co=ADWORDS.IsAWNCustomer%3Dfalse&hl=en
You could use this to determine the part number in the URL but it may require some mapping in the content management system.
I'm starting to use Insight API for Twitter from IBM Bluemix.
It's hard to find supporting resource for using this. So far I am using CURL and specifically formed URL to query the API service, and the service returns results in JSON format.
Here's an example of the URL I used with CURL to search for some tweets with the API:
https://(my seucrity key)#cdeservice.mybluemix.net:443/api/v1/messages/search?q=$MSFT%28posted:2016-01-01T00:00:00Z,2016-09-01T00:00:00Z%29&size=20
This URL returns a JSON object with tweets with keyword #MSFT, and between the time frame of 2016-1-1 to 2016-9-1, only return 20 tweets.
I would like to add to that link by specifying a language for the tweet to search for, so far I come up empty. Can you please help me ?
I have tried adding the following to the URL and did not do anything:
lang=EN, lang="en"
lang:en, lang:EN
Thanks.
The syntax is lang:en and you need to make sure to include it as part of your query.
I created the following query based on the one you provided in your question:
https://username:password#cdeservice.mybluemix.net:443/api/v1/messages/search?q=(%24MSFT%20AND%20posted%3A2016-01-01T00%3A00%3A00Z%2C2016-09-01T00%3A00%3A00Z%20AND%20lang%3Aen)&size=20
The unencoded query is
($MSFT AND posted:2016-01-01T00:00:00Z,2016-09-01T00:00:00Z AND lang:en)
You can find documentation here.
But in this link you can find more details on the syntax, which is:
/api/v1/messages/search?q=QUERY&size=NUMBER&from=NUMBER
I am using "/reader/api/0/stream/items/ids" API to get the item ids for sources that I want.
I have quite a number of sources, so I repeated "s=" parameter to include in the api url.
However, google has given me an error of "URL is too long".
So the question is that How can I solve it so that I just use one time api call to get item ids for that many sources?
Thanks
It seems that /reader/api/0/stream/items/ids path supports a POST method. This means the amount of data you could pass by using POST verb is much more than by using a query string and a GET method.
So use https://www.google.com/reader/api/0/stream/items/ids URL for the post, and pass your query string as a post data. Don't forget to include an action token(T) which is required for POST requests.
The following query will return results, but some of them will contain a limitedSyndication restriction. This cannot be filtered out by format or by restriction parameters.
http://gdata.youtube.com/feeds/api/videos?alt=json-in-script&callback=jQuery.youtube.response&q=Madonna&v=2&format=5&start-index=11&max-results=10
restriction parameter is not used in the query above because YouTube Data API reference guide states the following:
By default, the API filters out videos
that cannot be played in the country
from which you send API requests.
Am I doing something wrong? (Besides searching for Madonna)
How can I get rid of limitedSyndication results, or is this a bug?
As stated in the GData docs, you can pass a "restriction" param that will filter out results that can't be played by the ip you pass, so you just need to get the user's IP and pass that to the request:
To request videos playable from a specific computer, include the restriction parameter in your request and set the parameter value to the IP address of the computer where the videos will be played – e.g. restriction=255.255.255.255.
To request videos that are playable in a specific country, include the restriction parameter in your request and set the parameter value to the ISO 3166 two-letter country code of the country where the videos will be played – e.g. restriction=DE.
You should include this parameter in any request to retrieve a list of videos, including search results, playlists, favorite videos, video responses and so forth. If a video in the API response is not playable in the location that you're using to restrict availability of the content, the <entry> for that tag will not contain a <media:content> tag. However, it will contain a <yt:state> tag that indicates that the video is restricted.