apiaryio / language-templates Goto Github PK
View Code? Open in Web Editor NEWLanguage templates used to render example HTTP calls in different languages
Home Page: http://apiaryio.github.io/language-templates
License: MIT License
Language templates used to render example HTTP calls in different languages
Home Page: http://apiaryio.github.io/language-templates
License: MIT License
The cURL examples are not usable on Windows (in command line prompt) due to the use of \
as multiline separator and the use of single quotes.
When there are multiple parameters in a Resource URI, and at least one with a pct-encoded character the rendered code sample show incorrect URL.
Consider following blueprint:
Request URL renders fine with:
# /notes{?foo%2Ebar}
### POST
+ Response 201 (application/json)
Appending one additional query parameter, let's say a
results into incorrect URL in the example. Compare (correct):
With incorrect:
Also
The downstream effect here is that the incorrect URI is sent to the API server so the response is malformatted creating an error.
Originally reported at SO
The current Python example implementation leverages Python 2 libraries, do you have plans to add Python 3 examples? Python 2 is now legacy and the examples can no longer be used as is.
JSON objects translated to Perl hash references use :
as the separator instead of ,
or =>
, which causes syntax errors.
There can be unbalanced braces in generated code, which causes syntax errors.
JSON containing embedded newlines is single quoted, which double escapes the newlines, causing literal \n
characters to appear in embarrassing places. This can be avoided by using qq'...'
or regular double quotes instead of single quotes, however that will trigger Perl
's string interpolation on the entire string, so it might be necessary to only double quote the newlines:
my $hr = {
'abc' => 'def' ."\n". 'ghi',
};
In order to see this in action, head over to the SparkPost API docs, click the <
on the black background near the top right hand corner, click Create Transmission with Inline Parts Content, and scroll down to select Perl
from the language dropdown.
The link in the header description of this repo gives a 404 http://blog.apiary.io/language-templates
the example python code would be much simpler if it used requests
The request Uri for the C# example code is broken for all samples, instead of the relative url the samples display "undefined"
From the sample (http://docs.pollsapi.apiary.io/):
using (var response = await httpClient.PostAsync("undefined", content))
{
string responseData = await response.Content.ReadAsStringAsync();
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.