Static url variable is not found in POSTMAN request - api

I want to define a custom static url for my connections in Postman:
Then I tried calling a GET request by that custom static url:
But I get Could not send request message because the variable is not defined somehow:
But I don't know why it can not be found since I have defined at Variables section of the Collection and called it like this:
{{staticUrl}}/api/users?page=2
So what's going wrong here? I would really appreciate if you share any idea about this with me...

Make sure you save your collection and then move to the actual request tab. I forgot to do the same and Postman cannot resolve the variable.
Also make sure not to press enter button after creating your variable name. It causes Postman to register carriage return symbol ⏎ and thus creates a key with an additional character.

Related

overriding basePAth for Edit or ShowButton

In reference to this: https://github.com/marmelab/react-admin/pull/1491
That is not overriding the url that gets called.
I thought this meant to change the basePath of the URL that hoes to the API not the internal one to the frontend site, hopefully that makes sense.
So essentially I want to override the basePath so I can call a different URL on the backend side. If this is not what was intended , how can I override a action of the EditButton or ShowButton to call a different URL?
Or the other option that I can think of is: if we have a way to override the attribute that gets picked at the moment the button gets clicked, that is for an instance for complex structures instead of sending the id to lookup you could use something like: user.id.
Thanks in advance.
I guess the answer to this is to customise the dataProvider. But I don't see it as a clean solution to have to customise the dataProvider for such a case scenario :(

How to make a redirect in velocity template?

How to redirect to http://google.com in the code .vm file? (I mean within
#if <redirect to Google here> #else ... #end statement)
Doing
setRequestURI('http://google.com')
or similar doesn't work and I'm not sure if it is possible at all.
Thank you.
Can anybody explain please?
IMHO a template is the wrong place to implement logic like this. You should determine upfront (in whatever you do - you don't mention your environment other than velocity), before you determine that the velocity template in question should render the output.
Once you're in the template, you can't assume that you're within a web browser (it might render an email message) or that you have access to the response headers (the template might be rendered as part of a page when the response has already been "committed", e.g. the headers are already sent to the browser.
Do yourself a favor and move the logic further up the chain, out of your velocity template. If you need a quick fix: render Javascript that triggers the redirect. But pay back this technical debt sooner rather than later.

Setting a default element in SOAPUI

I've been using SOAPUI a lot lately and noticed that there are some elements I want to set for all request, such as an API key, or a date range.
Is there a way to automatically do this?
example: Every request begins with:
?
Is there a way to automatically fill in the api key for every request?
thanks.
I think the answer is No.
But you can try playing with defining properties. You can set properties at project level and then use the property everywhere you need.
It is not automated - you have to use the property correctly everywhere you need it.
In the project tree on the left you see all your WSDLs and its operations. Right click on an operation and choose New request.
Open the new request and set the default properties you want. Now you have two possibilities.
Add to TestCase
Right click on the request and choose that option. Then you can choose the TestCase to which you want to add the request.
Copy to TestRequests
Right click on the request and choose that option. Now you can choose existing TestRequests to which you want to add the values of the given request. I haven't used that option till now. You have to try if it works as expected.

Dumping browser document content using Zombie.js

Using browser.visit, I am fetching the page of a browser as shown in the documentation. According to the browser API, browser.document returns the main window's document. However, I am not sure how to dump (display) the contents of the document. Is there a method like browser.document.toString() or browser.document.text() to be able to print the contents of the document in the console.
Thanks,
Sony
What you want is probably:
browser.document.innerHTML
There is a browser.text(selector, context?).
Selector is a CSS selector evaluated against the document body.
Context is a optional second argument, the CSS selector is evaluated against the element given as the context.
You can say something like browser.text('body') to get the text in the body.
I got here while looking for answer for the same question.
I may be late for the party, but try using
Browser.visit(url, function(error, browser){
fs.appendFileSync('index.html', browser.html());
})
Remember to put error checking here and do better handling, but should give you basic HTML document.
If it's not necessarily HTML (like you find yourself pulling XML or JSON through Zombie due to complicated, valid reasons...), you can access it like this:
browser.document._childNodes[0]._nodeValue

Z_Form :: Adding a custom error message to zend_form inside Action Controller

I'm new to ZF and I'm discovering how to use Zend_Form and utilize it's capability like validating and filtering input values. I already know the basic of Zend_form like building a form and add element into it. My problem is that I want to add a custom error message to form element and I want to define that message inside the action controller that instantiated the form. I want to defined the error message inside the controller because I need to perform a validation against the database. For example checking if the username/email already exist in the database. I tried googling and that's leads me to setErrorMessage method of zend_form but when I try to use it, the error message is not showing at all... I also tried zend_form->setError and still no error displaying in the view script. Is my idea of setting custom error in the action controller correct or this should be done the other way?
Are you using Zend_Validate_Db_RecordExists?
Something like this should work:
$form->getElement('username')->getValidator("RecordExists")->setMessage('This username exists',
Zend_Validate_Db_RecordExists::ERROR_RECORD_FOUND
);
This works for me:
$form->getElement('username')->addError('This username exists.');