I am new to API Blueprint so please excuse my naivety here. I am trying to format some parameters such as given in the Aglio example:
+ Parameters
+ name (optional, string, `alice`) ... Search for a user by name
+ joinedBefore (optional, string, `2011-01-01`) ... Search by join date
+ joinedAfter (optional, string, `2011-01-01`) ... Search by join date
However, all that is displaying for the name of the parameter is the index of the parameter. Here is the display from the Atom API-Display package: https://atom.io/packages/api-blueprint-preview.
How can I make it display the name of the parameter?
The snippet of blueprint looks OK. Just for the sake - can you share the URI template used to defined the respective resource? The URI template should contain something like this:
{?name,joinedBefore,joinedAfter}
e.g.
# Resource [/resource{?name,joinedBefore,joinedAfter}]
But again the blueprint looks OK so it might be a problem with Aglio or the preview package itself. Best to check and report at https://github.com/danielgtaylor/aglio/issues?state=open or https://github.com/danielgtaylor/atom-api-blueprint-preview/issues.
Related
I have read the documentation on: https://github.com/intuit/karate#path
I have also read many answers on related subject on these forums, most notably: How to dynamically create URL having path in between URL using Karate framework
However, I still cannot get my head around this concept. Perhaps I am even more a newbie than a typical newbie. My problem is this:
The complete api: /sample/api/v1/sampleweb/{sampleweb}/webversion/{version}
Feature:
Background:
* def baseUrl = '/sample/api/v1/'
#postRandomData
Scenario: POST API for creating data
Given url host
And path baseUrl
How in the world can I add the rest of the Url to "baseUrl" (basically the complete path listed above)? Should I throw "sampleweb/{sampleweb}/webversion/{version}" into a variable and then just do "baseUrl + variable"?
Please advise.
#hungryhippos what i do to have this kind of flexibility is to use something like:
var endpoint = '/sampleweb/{sampleweb}/webversion/{version}'
.replace('{sampleweb}', param1)
.replace({version}', param2)
Just use string concatenation. Just like normal JavaScript. Here try to spot the difference between "hard coded" strings and variables.
* def want = 'something'
* url baseUrl + '/anything'
* path 'you', want
I'm trying to migrate my ASPX site to Kentico, and as part of my task I'm migrating URLs. I need to preserve my URL structure, so I need to keep URLs which look like : "foo.com/bar.aspx?pageid=1".
I checked page's "URLs" property tried to use wildcards, some patterns like /bar/{pageid}- /bar/{?pageid?}-, etc but Kentico always replaces question marks.
Is there a way to achieve that via the admin interface?
You don't need to do anything in order to use "foo.com/bar.aspx?pageid=1" url.
Create a page under the root and call it bar, so you'll get a page # foo.com/bar.aspx. Kentico and/or .net does not care what you add to a url after question mark, so foo.com/bar.aspx?pageid=1 will work as well as foo.com/bar.aspx?someparam=sdf, or foo.com/bar.aspx?id=1&p=3&t=3.
You may (or may not) implement some functionality based on query string (e.g. paging), so it will parse query string and act in appropriate way.
By default Kentico UI does not handle adding URL aliases with URL parameters like you show. There is an article on the DevNet for a URL Redirection module which has code you can import into your site to allow you to perform these redirects within the Kentico UI. I'd suggest using this approach.
Unfortunately, I can't share a code sample since it's an article but it also has a link to download the code too. This appears to only be coded for Kentico 8.2 right now but I'm guessing you could do some work to make it work for other versions if you needed.
I think there are few concepts that you are clubbing here. I will start with your line code here
/bar/{pageid} - {pageid} is a positional parameter in Kentico's language if you choose to use dynamic URLS based on patterns. SO if you have a code that relies on pageid parameter to fetch some data then Kentico will pass that value. E.g in case of /bar/420, it will pass pageid as 420 different web parts on your template
/bar/{?pageid?} - This will search for query string parameter "pageid" on the request URL and replace its value here. So if you passed foo.com/bar.aspx?pageid=366, the resulting URL will be /bar/366
The #1 is positional parameter and #2 is the way in which Kentico resolves query string macros.
I hope this clarifies.
So normally I would use the s.getQueryParam(); to parse out my URLs for query strings that I've been using.
s.eVar8=s.getQueryParam('cid,pid,eid',':');
s.prop28=s.getQueryParam('Role');
But since DTM has that all built into it, how would you really define that? I know I can set a page load rule using the campaign variable, but what if I have multiple parameters separated by ":"
www.domain.com?cid=blah1:blah2:blah3&pid=blah4:blah5:blah6&eid=blah7:blah8:blah9
Is there something that I'm missing when using this approach? Should I be capture these values into a data element then passing the data element into a page load rule using an eVar or sProp?
For variables that only look for a single URL parameter:
Create a Data Element of Type URL Parameter. For Parameter Name, put e.g. "Role" (no quotes) for prop28. Alternatively, you can do the same thing below, for multiple.
For variables that look for multiple URL parameters:
Create a Data Element of Type Custom Script. Click the [Open Editor] button and in the code box, add the following:
var d=':',
p=['cid','pid','eid'],
v=[],c,l,q;
for (c=0,l=p.length;c<l;c++) {
q=_satellite.getQueryParamCaseInsensitive(p[c]);
if (q) v.push(q);
}
return v.join(d);
The d= and p= values are based on what you have for eVar8. This isn't 100% the same as AA's s.getQueryParam plugin but it's most of it; the parts you care about based on your posted code.
Reference the Data Element(s)
In the Adobe Analytics tool config, in the Global Variables section, you can add your prop(s) and eVar(s) there, using %data_element_name_here% syntax.
Mandrill has a great feature that allows one to use Handlebars in templates to customize email content. See docs here.
One of the helpers that Madnrill supports is date that can be used like {{#date}}. The default date format is d/m/Y. My question is how can I specify a different date format (e.g. yyyy)?
I need to display something like 2015 Name. I tried:
{{#date yyyy}} Name - displays 05/31/15 (default format and seems to erase any HTML after it).
{{#date 'yyyy'}} Name - displays {{#date 'yyyy'}} Name (can't be parsed).
{{#date yyyy}}{{/date}} Name - displays 05/31/15 Name (default format).
{{#date 'yyyy'}}{{/date}} Name - displays {{#date 'yyyy'}}{{/date}} Name (can't be parsed).
Appreciate you help ;)
The issue was 2-fold:
You should use {{date}} instead of {{#date}}
You should use double quotes for formatting
The correct syntax would be {{date "Y"}}.
Mandrill also updated their docs that now provide more details on handlebars syntax.
I would assume this may follow the original Merge Tag formatting. Have you tried this?
http://kb.mailchimp.com/merge-tags/all-the-merge-tags-cheatsheet
Use |DATE:FORMAT| to show the current date in a given format. For example, |DATE:d/m/y| where d is replaced by the day, m by the month, and y by the year. View a full reference of date options on the PHP website. This format isn't available for automation workflows.
I am trying to implement this-
https://gist.github.com/MendelGusmao/2356310
Lua,nginx based URL shortener,The only change i want to implement is when some query string parameter comes with shortened URL i need to take that parameter and insert into the long URL.
e.g.
http://google.com?test=2 will be like http://abc.in/abc
while hitting on http://abc.in/abc?test=3 I get redirected to - http://google.com?test=3.
For that i need to take query string parameters from $request_URI, can any one help with some code?
You should be able to use ngx.var.arg_name where name is the name of the query parameter you want to access. See Variables with Infinite Names section in this tutorial for details on query parameter handling; you may also check my blog post for Lua nginx/openresty examples.
As an alternative, you can use ngx.req.get_uri_args() to retrieve all query parameters as one table. See this section in the same tutorial for the brief comparison between these methods.
You can also use ngx.var.QUERY_STRING to access the query string and unescape and parse it.
You can obtain the query parameter with just nginx by using $arg_test, test is the name of the query parameter in this example.
This is documented in http://nginx.org/en/docs/http/ngx_http_core_module.html#var_arg_.