-
Notifications
You must be signed in to change notification settings - Fork 14
06.0 Expressions
Stubmatic has supports of expression. It helps you to fill some data in your response dynamically without any programming. You use them anywhere in your response, and they will transformed to a particular value.
{{TODAY}} : It'll be transformed to current date.
{{TODAY+N}} , {{TODAY-N}} : This will do some calculation over today's date. {{TODAY-1}} means yesterday's date and {{TODAY+1}} is tomorrow's date.
{{TODAY-ny+nm-nd}} : You can also do date calculations specifying number of years, month, and dates.
All above markers return the dates in 'yyyy-mm-dd' till version 3.6.0. 3.7.0 onwards above date markers give full form date. You can use formatDate() function to format them
JODA_TODAY can be used to use joda date time library for date calculation.
{{URL:someurl}} : depricated
3.7.0 onwards
#Function
##Format date
###Syntax
{{formatDate(TODAY,"dd D, MMM YYYY HH:mm:ss")}}
###Supported characters
- yyyy : Full year
- YYYY : Full year
- yy : Last 2 digit of year
- YY : Last 2 digit of year
- MMMM : Full Month
- MMM : 3 letters of month
- MM : Month in 2 digits: 01, 12
- M : Month in number: 1, 12
- dd : Date in 2 digits: 01, 31
- d : Date in number: 1,31
- DD : 3 letters of week Day
- D : week day in number
- HH : Hours in 2 digits: 01, 23
- H : Hours in number: 1, 23
- mm : Minutes in 2 digits: 01, 59
- m : Minutes in number: 1, 59
- ss : Seconds in 2 digits: 01, 59
- s : Seconds in number: 1, 59
##Random ###Syntax
{{random(length)}}
{{random(length,'alpha_num')}}
###Supported type
- ALPHA
- NUM
- ALPHA_NUM
Example
{{random(14,'alpha_num')}}@gmail.com {{random(14,'alpha_num')}}@{{random(4,'alpha')}}.com
2001:{{random(4,'alpha')}}:{{random(4,'alpha_num')}}:{{random(4,'alpha_num')}}:{{random(4,'alpha_num')}}:{{random(4,'alpha_num')}}:{{random(4,'alpha_num')}}:{{random(4,'alpha_num')}}:{{random(4,'alpha_num')}} {{random(3,'num')}}:{{random(3,'num')}}:{{random(3,'num')}}:{{random(3,'num')}}
4917{{random(12,'num')}}
Card Type : Card Number Prefix
- American Express : 34, 37
- China UnionPay : 62, 88
- Diners ClubCarte Blanche : 300-305
- Diners Club International : 300-305, 309, 36, 38-39
- Diners Club US & Canada : 54, 55
- Discover Card : 6011, 622126-622925, 644-649, 65
- JCB : 3528-3589
- Laser : 6304, 6706, 6771, 6709
- Maestro : 5018, 5020, 5038, 5612, 5893, 6304, 6759, 6761, 6762, 6763, 0604, 6390
- Dankort : 5019
- MasterCard : 50-55
- Visa : 4
- Visa Electron : 4026, 417500, 4405, 4508, 4844, 4913, 4917
+44{{random(10,'num')}}