I want to call the twilio voice API without providing the URL.
Normally you would do it like this using python:
call = client.calls.create(url="http://demo.twilio.com/docs/voice.xml",
to=request.receiver,
from_=sender_number)
Instead of providing the URL I want to provide the XML-String. Is that somehow possible?
Background:
I'm generating the XML via a google cloud endpoints api. The response is in JSON format and a variable contains the XML. I need to parse the JSON to get the XML.
Sounds like you could use the echo Twimlet.
https://www.twilio.com/labs/twimlets/echo
Echo will just output whatever TwiML is passed into it via the URL. It is useful for building stateless, outbound apps, where arbitrarily complex content of the call is pre-generated and just passed into the REST API to initiate a call.
Example: http://twimlets.com/echo?Twiml=%3CResponse%3E%3CSay%3EHi+there.%3C%2FSay%3E%3C%2FResponse%3E
Twilio Evangelist here. I'm afraid you cannot do this, however there are a number of solutions. If your call doesn't require any dynamic XML, you can host it on S3, or a similar service (I use Dropbox public links quite a lot).
If you do need dynamic XML, then we have a whole bunch of tutorials that can help you get setup with a simple web application.
Hope this helps!
Related
I'm trying to create a system for creating and sending emails through the GMail API. I have gotten a receive workflow working (Oauth, retrieves and parses emails). So I have seen the 'Message' JSON objects that Google uses.
Now I want to send out a 'Message' that was created by my system. So I'm looking for information about what is the minimal or basic set of elements needed to create a valid 'Message' object for Google's GMail API.
My platform is using FileMaker Pro... so I can't really use any existing library for their templates and functions. I am looking to build the JSON object directly, with text functions.
I have seen the GMail API documentation. It doesn't really seem to clarify what is required or optional. One side point: Message ID - it doesn't describe the parameters for that. Can I set it to anything I want? Is that something only generated as a PK for Google's own database to store it under? (Apparently it's not required, as it seems it will be defined and returned in the Send response.)
I note that it has the 'Raw' element... maybe it's simpler to build the RFC 2822 text from a template of some sort, doing targeted replacements? It still is a matter of - what's minimally needed in the template? (Would eventually like to be able to send attachments, too.) And it seems that building a JSON object version would be more readable, maintainable, and/or robust.
Thanks,
J
Lets say I had a Python script that determined the users favorite fruit, then sent the data:
fruit = apple
to a website named apples.com
How can I do this?
Also, If you can, can you explain the web end of the exchange, or should I make another post for that?
I am not sure which tags to use, so recommendations are welcome.
The question is pretty vague. You could take a look at the request module to send POST request to the website. The data could be enconde in json format. You'll need to have some sort of API on the website to use the received data. You can make a simple app with Flask.
I am a bit new to the whole APEX service plugins but I was wondering if Salesforce has native support for Swagger, or any similar REST description language, for the REST api's that I create in the APEX service platform?
For example:
#RestResource(urlMapping='/v1/users/*')
global with sharing class UserRestService {
...
#HttpGet
global static List<Member__c> doGet(....)
{
...
}
}
I would like the ability to return the swagger json, a WADL document, or something for this REST service (and all other REST services I have in there). Does anyone know of a way I can do this?
Thanks in advance!
There is no built in support at this time. I was interested in seeing what could be done via currently available public APIs. The first thing I ran into is the grammar does not seem to like parameters to HttpGet methods. That right there will make it challenging since the only way to get input parameters appears to be via the Request entity which means you would have to parse the actual code. In other words, there does not appear to be declarative input binding.
Further, in looking at the tooling API which let's me get some amount of "reflective" information about the class, there is not always sufficient information to render a response payload (in your case, it just shows LIST but not what's in the list)
Again, it looks like one would have to rely on a parser (there is at least one Antl grammar floating around).
(this is getting some internal attention but I can't say any more at this time)
I made a POST request to a Sinatra app. I noticed that the parameters arrive in the server as a StringIO. It can be read using request.body.read. However, it can only be read once. To read it again, I need to run request.body.rewind (haha, Sinatra).
Why is it designed this way? I can see this being useful in streaming data but are there other applications?
Parameters are available within Sinatra via the params hash. request.body.read and request.body.rewind are part of Rack, they are not actually implemented within Sinatra. The most common way I have used this in the past is when I'm using Sinatra strictly as a web API and serializing/de-serializing my payload.
I'm trying to create a REST call to Azure to List Blobs within a container. The container is private so I need to access it through a Shared Access Signature (SAS).
I make that call in a Silverlight application so I cannot use the Client API.
I find a lot of examples with ClientAPI but nothing really clear and obvious for REST.
Anyone has a nice... clean and simple example on how to do that?
Thanks
I wrote a blog post a few days ago about exactly the same: http://gauravmantri.com/2013/02/13/revisiting-windows-azure-shared-access-signature/. I've included samples for various common functions both using REST API and Client library. As far as listing blobs is concerned, if you use REST API you get raw XML back which you would need to parse in your SL app.