Qmetry - How to update value of a key of api request in .wsc file - qaf

In Qmetry, I have placed api request data in requests.wsc file. For example in the below api request- want to update 'baseUrl' key value from 'https://google.com' to 'https://stackoverflow.com' through qmetry method/ or programmatically.
api request content in requests.wsc file:
get.sample.call={'headers':{'Accept':'application/xml'},'baseUrl':'https://google.com','method':'GET','query-parameters':{},'form-parameters':{},'body':''}
Can any one help me on achieving this within qmetry or any other way? Thanks!

Refer documentation of Request Call Repository. You should use parameters and parameter-resolution done at the time of execution. For example:
get.sample.call={'headers':{'Accept':'application/xml'},'baseUrl':'${env.baseurl}','method':'GET','query-parameters':{},'form-parameters':{},'body':''}

Related

How to pass dynamic value to JSON as a API request in flutter flow?

I have two page
Login/Registration Page as of now
OTP Verification Page
API has been created and in api, we are passing phone number as request and gets otp as response. However i would like your help to know how should i able to pass the phoneNumber textfield data to APIcall json request in flutterflow?
If there is anyway or any documentation will be really helpful?
I have tried with variable method, however i was not able to pass it to json.
I have also tried jsonpath method, but no luck.
Define dynamic part of API url with brackets
https://jsonplaceholder.typicode.com/posts/[postId]
https://jsonplaceholder.typicode.com/comments?postId=[postId]
then create the variable (postId) with the same name. When adding the API call, it is required to add these variables.
See API Calls 101 for details.

Run a flow from another flow in Twilio

How can I run a flow from another flow in Twilio Studio Flow?
Help with defining the To and From HTTP parameters:
I am a beginner in programming so I am failing to understand the brief notes given in support docs, namely specifying HTTP additional parameters for "To" and "From".
Additional details from comment:
I am trying to run REST API triggered Flow B from primary Flow A by using an http request widget in Flow A in the format below: (as suggested in a similar problem posted on this portal) Widget: HTTP Request [ACCOUNT_SID:AUTH_TOKEN#studio.twilio.com/v1/Flows/THE_OTHER_STUDIO_FLOW_SID/Executions][2] Content Type: Form URL Encoded KEY:VALUES To:+1234567890 From:+2773123456 I am getting error 401. I tried to swap the To number with the From number without success
There are 2 ways you can trigger one twilio studio flow from another
Method 1:
Use the TwiML Redirect Widget. Place the widget where you need it and specify the target studio flow URL there. Studio URLs have the following format
https://webhooks.twilio.com/v1/Accounts/{AccountSid}/Flows/{FlowSid}
Method 2:
Do the same as above programmatically. You can send twilio a twiML response such as the one below
let twiml = new Twilio.twiml.VoiceResponse();
if (something) {
twiml.redirect({
method: 'POST'
}, 'https://webhooks.twilio.com/v1/Accounts/{AccountSid}/Flows/{FlowSid1}');
} else {
twiml.redirect({
method: 'POST'
}, 'https://webhooks.twilio.com/v1/Accounts/{AccountSid}/Flows/{FlowSid2}');
}
For more info, check out https://www.twilio.com/docs/voice/twiml/redirect
Assuming you are not trying to bridge the call between the two flows, this should be possible. To simplify:
You have a call come in on Flow A ("Incoming Call" trigger on Flow A).
Flow A executes its logic.
That logic triggers Flow B by calling its REST API endpoint so that it makes a new outbound call ("REST API" trigger on Flow B).
This last thing is the hard part. Make sure you are looking at the docs for the REST API Execution resource. To trigger a new flow, you need to make a POST request which supplies the To and From parameters.
If you are a beginner at programming, it might be helpful for you to start with a separate HTTP client like Postman to start to get familiar with the structure of an HTTP request, and learn the full extent of what is required to successfully make this API request before you start trying to cram it into Studio and automate it.
That said, this request should be possible to do within the Studio Make HTTP Request widget. If you make your content type Application/JSON, you can pass the To/From parameters directly in a JSON-formatted request body, like this:
{
"To": "+19995551234",
"From": "+12345556789"
}
To be perfectly honest, I don't know what the widget means by "Http Parameters". This could be HTTP Headers, URI parameters, or something else. I think the JSON form is clearer.
I came across the same situation. The solution for authentication is to change the url to include AccountSid and AuthToken
https://[AccountSid]:[AuthToken]#studio.twilio.com/v2/Flows/[SID]/Executions
Instead of Application / Json, use Form Parameters. Then add individual parameters below, for To, From, and Parameters​ (JSON string) for other variables.

How to upload an image file using Rest Assured framework?

I am trying to upload a file using the rest assured framework. The call is a POST call on the API that i am using and the code is mentioned below:
given()
.contentType("image/jpg")
.accept("application/json")
.auth().oauth2(accessToken, OAuthSignature.QUERY_STRING)
.multiPart(new File("C:/Snap0000.jpg"))
.post("/objects/files")
.getBody();
The error that I get when doing this is:
400 - Unable to read image info Couldn't read magic numbers to guess format.
What am I doing wrong?
You may be missing the control name for the multipart? See javadoc for the multiPart method or look at the documentation.
Edit: above link is (partially) broken; this one at github seems to work better: https://github.com/rest-assured/rest-assured/wiki/Usage#multi-part-form-data

JIRA Tempo Plugin

I'm trying to use the API for JIRA's Tempo :
https://tempoplugin.jira.com/wiki/display/TEMPO/Tempo+Servlet+Manual#TempoServletManual-WorklogReport
specifically trying to get worklogs through the url:
http(s)://yourserver.yourdomain/plugins/servlet/tempo-getWorklog/?dateFrom=2011-01-01&dateTo=2011-01-31&format=xml&diffOnly=false&tempoApiToken=my-token
What should be the values for yourserver and yourdomain. if im testing on a localhost, is it 'localhost:port'? or is it the actual url for my account on jira, example: 'jira.companyname.com'? I'm using RestClient to make the request in my app.
It will be actual url for your account on jira. eg -
https://companyname.jira.com/plugins/servlet/tempo-getWorklog/?dateFrom=2014-04-21&dateTo=2014-04-27&format=xml&tempoApiToken=e4cd79c4-0457-42f3-bf29-6f3f0f5c8bcf&projectKey=project&addUserDetails=true&addIssueDetails=true&addWorklogDetails=true&addIssueSummary=true&addIssueDescription=false
The above url returns the result in xml format. Change the appended parameters according to your need. Make sure you enter the right tempoApiToken value (tempo administrator has this value).

Twitter oauth_callback parameter being ignored!

I'm trying to get Twitter authentication working on my ASP.NET site. When you create the app on the Twitter website, you have to specify a callback URL, which for sake of argument, I have set to http://mydomain.com
I've read the oAuth 1.0a spec, and to override this callback URL with your own custom one you have to send the oauth_callback parameter in the request_token phase (url-encoded of course).
So my request URL looks like this:
http://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Fmydomain.com%2Ftwittercallback
Supposedly, if all goes to plan, in your response data, you are supposed to receive a new parameter of oauth_callback_confirmed=true in addition to your token and token secret parameters.
However, my response comes through as:
oauth_token=MYTOKEN&oauth_token_secret=MYTOKENSECRET
I know I haven't given you guys the greatest amount to go on, but I'm at my wits end as to why I am not receiving the oauth_callback_confirmed parameter. Without this, my application keeps defaulting back to the callback URL hard-coded on the Twitter website. Please if anyone could help me out, I will be eternally grateful!
Thanks,
A.
I've read the oAuth 1.0a spec, and to
override this callback URL with your
own custom one you have to send the
oauth_callback parameter in the
request_token phase (url-encoded of
course).
So my request URL looks like this:
http://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Fmydomain.com%2Ftwittercallback
just because YOU read the spec doesn't mean that TWITTER read it. :P
kidding - this is essentially correct - but the way twitter likes to receive this data is a little different (and not well documented).
the way i've found to get the oauth_callback to confirm is as follows: specify the oauth_callback in the parameters of the request function, NOT within the URL.
python example (using oauth2):
''' Create our client.'''
client = oauth.Client(consumer)
''' do the request '''
resp, content = client.request(request_token_url,"POST",body=urllib.urlencode({'oauth_callback':callbackURL}))
''' note that it's called "body" in this particular OAuth function for Client but in OAuth Request object it's called "parameters." YMMV depending on programming language/ library of course. '''
this is ALSO the only way i've managed to get an oauth verifier back. supposedly one should not have to specify the callback URL every time, since we provide it in app settings...but experience seems to indicate otherwise.
finally, please be aware that at leg 3 you have to do the same thing AGAIN - this time including the oauth_verifier as well as the callback URL in the parameters.
hope this helps - can't begin to tell you how much effort i put into figuring this out.
good luck!
J
I've used this guide to set up my PC to be used as the callback location. Basically you set up your hosts file in a certain way, clear your cache and add a couple of Firefox registry values. At the end when you are debugging an oauth call the redirect comes back to your local PC.
As I said it worked for me.
<?php
// oauth-php example
$token = OAuthRequester::requestRequestToken(
$consumer_key,
$user_id,
array('oauth_callback'=> urlencode($callback_uri))
);
?>

Resources