Can multiple requests update a single environment variable in Paw? - paw-app

I have a variable named primary_address_id which can be set or updated via several API requests. For example, I may call AddAddress and specify that the new address should be the primary, or I can call MakePrimaryAddress to set an existing address as the primary.
I'm coming from Postman where I have tests defined for each of these API endpoints to update primary_address_id -- simple. But I can't find a way to do this in Paw; it seems I have to set the value to the response of just a single request. Am I missing something obvious? Or is this feature planned for a future release?
A workaround is to set the value of primary_address_id to the response from GetPrimaryAddress, but that means if I'm adding or updating an address I have to make a second call just to update my environment (which I may forget to do). If I could trigger GetPrimaryAddress to run after the Add/Update/List/etc endpoints that would be an acceptable workaround, but I shouldn't need to manually make two separate requests to accomplish this.

It sounds like you will need to make two subsequent requests but you can make groups of requests that will execute in sequence from one command.
Right click the request list and click "New Group" then within that group you can make a sequence of requests that will update your desired environment variable each time.
Create a new group of requests
To run a group of requests click on the group name; in this case "Address" and then click "Send Requests"
Execute group of requests in sequence
Hope this helps.

Related

Logic App using HTTP Action to access and GET Jira ticket

So I followed this answer and it works fine:
https://stackoverflow.com/a/74981947/20829088
Provided URL:
https://<YOUR_DOMAIN>.atlassian.net/rest/api/2/search?jql=project=<PROJECTID>&fields=issue,status,name&startAt=0&maxResults=8000
However, it take a lot of time. So, if I want the url to check for specific ticket depending on created time and type of ticket. For example
I want ticket that is created within 15 days and that are NOT a sub-task.
so I tried something like this.
.....&fields=issue,summary,issuetype&created>=-15d&hierarchylevel=0
I'm not sure of how it should be written I just tried this and it doesn't work.
Here is the request result in JSON:
It should be earthier [subtask=false] OR [hierarchylevel=0] OR [name=Task]
After reproducing from my end, I could able to achieve this using Condition connector of logic apps. I have initialized an array variable first and then tried to append each item that satisfies the condition. Below is the flow of my logic app.
and then I used Parse Json to retrieve the required values for condition comparision
You can use the below Code view to reproduce the same in your environment.
{"definition":{"$schema":"https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#","actions":{"For_each":{"actions":{"Compose":{"inputs":"#items('For_each')?['fields']?['created']","runAfter":{},"type":"Compose"},"Condition":{"actions":{"Append_to_array_variable":{"inputs":{"name":"Array","value":"#items('For_each')"},"runAfter":{},"type":"AppendToArrayVariable"}},"expression":{"or":[{"greaterOrEquals":["#formatDateTime(outputs('Compose'),'yyyy-MM-dd')","#formatDateTime(addDays(utcNow(),-15),'yyyy-MM-dd')"]},{"equals":["#items('For_each')?['fields']?['issuetype']?['subtask']",false]},{"equals":["#items('For_each')?['fields']?['issuetype']?['hierarchyLevel']",0]},{"equals":["#items('For_each')?['fields']?['status']?['statusCategory']?['name']","Task"]}]},"runAfter":{"Compose":["Succeeded"]},"type":"If"}},"foreach":"#body('Parse_JSON')?['issues']","runAfter":{"Parse_JSON":["Succeeded"]},"type":"Foreach"},"HTTP":{"inputs":{"authentication":{"password":"<API_KEY>","type":"Basic","username":"<USERNAME>"},"method":"GET","uri":"https://jira#<ProjectName>.atlassian.net/rest/api/2/search?jql=project=<ProjectID>"},"runAfter":{},"type":"Http"},"Initialize_variable":{"inputs":{"variables":[{"name":"Array","type":"array"}]},"runAfter":{"HTTP":["Succeeded"]},"type":"InitializeVariable"},"Parse_JSON":{"inputs":{"content":"#body('HTTP')","schema":{"properties":{"expand":{"type":"string"},"issues":{"items":{"properties":{"expand":{"type":"string"},"fields":{"properties":{"aggregateprogress":{"properties":{"progress":{"type":"integer"},"total":{"type":"integer"}},"type":"object"},"aggregatetimeestimate":{},"aggregatetimeoriginalestimate":{},"aggregatetimespent":{},"assignee":{},"components":{"type":"array"},"created":{"type":"string"},"creator":{"properties":{"accountId":{"type":"string"},"accountType":{"type":"string"},"active":{"type":"boolean"},"avatarUrls":{"properties":{"16x16":{"type":"string"},"24x24":{"type":"string"},"32x32":{"type":"string"},"48x48":{"type":"string"}},"type":"object"},"displayName":{"type":"string"},"emailAddress":{"type":"string"},"self":{"type":"string"},"timeZone":{"type":"string"}},"type":"object"},"customfield_10001":{},"customfield_10002":{},"customfield_10003":{},"customfield_10004":{},"customfield_10005":{},"customfield_10006":{},"customfield_10007":{},"customfield_10008":{},"customfield_10009":{},"customfield_10010":{},"customfield_10014":{},"customfield_10015":{},"customfield_10016":{},"customfield_10017":{"type":"string"},"customfield_10018":{"properties":{"hasEpicLinkFieldDependency":{"type":"boolean"},"nonEditableReason":{"properties":{"message":{"type":"string"},"reason":{"type":"string"}},"type":"object"},"showField":{"type":"boolean"}},"type":"object"},"customfield_10019":{"type":"string"},"customfield_10020":{},"customfield_10021":{},"customfield_10022":{},"customfield_10023":{},"customfield_10024":{},"customfield_10025":{},"customfield_10026":{},"customfield_10027":{},"customfield_10028":{},"customfield_10029":{},"customfield_10030":{},"customfield_10033":{},"description":{},"duedate":{},"environment":{},"fixVersions":{"type":"array"},"issuelinks":{"type":"array"},"issuetype":{"properties":{"avatarId":{"type":"integer"},"description":{"type":"string"},"entityId":{"type":"string"},"hierarchyLevel":{"type":"integer"},"iconUrl":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"self":{"type":"string"},"subtask":{"type":"boolean"}},"type":"object"},"labels":{"type":"array"},"lastViewed":{},"priority":{"properties":{"iconUrl":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"self":{"type":"string"}},"type":"object"},"progress":{"properties":{"progress":{"type":"integer"},"total":{"type":"integer"}},"type":"object"},"project":{"properties":{"avatarUrls":{"properties":{"16x16":{"type":"string"},"24x24":{"type":"string"},"32x32":{"type":"string"},"48x48":{"type":"string"}},"type":"object"},"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"projectTypeKey":{"type":"string"},"self":{"type":"string"},"simplified":{"type":"boolean"}},"type":"object"},"reporter":{"properties":{"accountId":{"type":"string"},"accountType":{"type":"string"},"active":{"type":"boolean"},"avatarUrls":{"properties":{"16x16":{"type":"string"},"24x24":{"type":"string"},"32x32":{"type":"string"},"48x48":{"type":"string"}},"type":"object"},"displayName":{"type":"string"},"emailAddress":{"type":"string"},"self":{"type":"string"},"timeZone":{"type":"string"}},"type":"object"},"resolution":{},"resolutiondate":{},"security":{},"status":{"properties":{"description":{"type":"string"},"iconUrl":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"self":{"type":"string"},"statusCategory":{"properties":{"colorName":{"type":"string"},"id":{"type":"integer"},"key":{"type":"string"},"name":{"type":"string"},"self":{"type":"string"}},"type":"object"}},"type":"object"},"statuscategorychangedate":{"type":"string"},"subtasks":{"type":"array"},"summary":{"type":"string"},"timeestimate":{},"timeoriginalestimate":{},"timespent":{},"updated":{"type":"string"},"versions":{"type":"array"},"votes":{"properties":{"hasVoted":{"type":"boolean"},"self":{"type":"string"},"votes":{"type":"integer"}},"type":"object"},"watches":{"properties":{"isWatching":{"type":"boolean"},"self":{"type":"string"},"watchCount":{"type":"integer"}},"type":"object"},"workratio":{"type":"integer"}},"type":"object"},"id":{"type":"string"},"key":{"type":"string"},"self":{"type":"string"}},"required":["expand","id","self","key","fields"],"type":"object"},"type":"array"},"maxResults":{"type":"integer"},"startAt":{"type":"integer"},"total":{"type":"integer"}},"type":"object"}},"runAfter":{"Initialize_variable":["Succeeded"]},"type":"ParseJson"}},"contentVersion":"1.0.0.0","outputs":{},"parameters":{},"triggers":{"manual":{"inputs":{"schema":{}},"kind":"Http","type":"Request"}}},"parameters":{}}

How to change irazasyed/telegram-bot-sdk's default request values of BASE_BOT_URL and the handler's verify option?

In order to connect my bot to the local bot API server and in order to turn curl's SSL verify_host and verify_peer off, how can I change irazasyed/telegram-bot-sdk's default request values of BASE_BOT_URL and the handler's verify option, not hard coding?
I know that I can change the BASE_BOT_URL constant in telegram-bot-sdk's TelegramClient class. And I know that I can change the verify option of my request handler to be false in guzzle's CurlFactory class. But, I'm not interested in hard-coding or overwriting these vendor files to avoid any update challenges in the future. I am more interested in something like longman/telegram-bot's setCustomBotApiUri function. The closest I could get is working with telegram-bot-sdk's setHttpClientHandler function, but I'm having trouble how to work with that.
Appreciate any help
P.S. I am using irazasyed/telegram-bot-sdk:^3.6 in my laravel:^9.2 app.

Q - Postman: How to clear collectionvariables between tests

I'm new to API testing through postman and i'm currently trying to figure out how to clear down my collection variables between automated tests.
Here is my code below - Thanks so much for anybody who can point me in the right direction.
Warning :
pm.collectionVariables.clear()
will delete all your collection variables:
pm.collectionVariables.unset("variablename")
will delete that particular variable.
so if you just want to reset the value to initial value then:
in the first request add:
pm.environment.get("resetValue") ? null:pm.variables.set("resetValue",pm.collectionVariables.toJSON().values)
Here we store data only if resetValue variable is not set
And in the last request:
pm.environment.get("resetValue").forEach((a)=>pm.collectionVariables.set(a.key,a.value))
pm.environment.unset("resetValue")
This make sure you don't set resetValue incorrectly if you are running first request multiple time
you can also use pm.variables if you don't any variable to be affected , thats the better way

Get all the action log of an instance and the flavor attached to it

I was wondering if anyone can tell me how to get the action log of the instance using openstacksdk, novaclient. And while getting the action log, I also want to get the flavor attached to it. See the attached picture please.
I actually got the action log using this novaclient module:
novaclient.v2.instance_action.InstanceAction
but it shows me very little details and without the flavor id that I needed. The following fields it shows me are the following:
action, instance_uuid, message, project_id, request_id, start_time and user_id
I hope anyone can tell me how to get it.
I don't think it is possible to get the flavor id from the action list / server event list.
Openstack does not keep a database record of what each request did, or a historic record of the instance states. So you would need to resort to trawling the logs for the request-id ... which is OK for forensics, but does not scale. (And I don't know if the flavor is in the log messages.)
Of course, you could use the APIs (novaclient, openstacksdk) to get the current flavor for the instance, given its instance id. But that isn't exactly what you want.
It is possible record historical information using Gnochi + Ceilometer or similar, but you would need to have set this up already.

IBpy cannot cancel open orders placed manually

When using ibpy trying to close some positions placed on TWS manually, it turns our we could not do this. Specifically, when performing:
self._tws.reqAllOpenOrders()
sleep(0.2)
We get the orders with id 0 (probably because i placecd it manually on TWS)
<openOrder orderId=0, contract=<ib.ext.Contract.Contract object at 0x103b78ad0>, order=<ib.ext.Order.Order object at 0x103b78a50>, orderState=<ib.ext.OrderState.OrderState object at 0x103b78b10>>
<orderStatus orderId=0, status=Submitted, filled=0, remaining=100, avgFillPrice=0.0, permId=134994568, parentId=0, lastFillPrice=0.0, clientId=0, whyHeld=None>
<openOrder orderId=0, contract=<ib.ext.Contract.Contract object at 0x103b78c90>, order=<ib.ext.Order.Order object at 0x103b78c50>, orderState=<ib.ext.OrderState.OrderState object at 0x103b78cd0>>
<orderStatus orderId=0, status=Submitted, filled=0, remaining=1, avgFillPrice=0.0, permId=134994562, parentId=0, lastFillPrice=0.0, clientId=0, whyHeld=None>
<openOrderEnd>
When trying to close it with:
self._tws.cancelOrder(0)
or
self._tws.cancelOrder(134994568)
I get the error:
<error id=0, errorCode=135, errorMsg=Can't find order with id =0>
<error id=134994562, errorCode=135, errorMsg=Can't find order with id =134994562>
Any idea how could we close them? Thank you.
You have to 'bind' the orders to the new client. Use this method tws.reqAutoOpenOrders(True). From the docs,
Finally, IBApi.EClient.reqAutoOpenOrders will allow to obtain those
orders manually placed using the TWS itself. This method also allows
the client application to take over these orders and modify them by
setting the autoBind parameter to true. If successfully bound, The
orders will be assigned (i.e. bound to) an API order id and as such be
eligible for modification.
client.reqAutoOpenOrders(true); Important: only those applications connecting with client Id 0 will be able to take over
manually submitted orders
Through the TWS' API settings it is possible to configure this
method's behaviour to some extent. As shown in the image below,
manually placed orders can be given a negative order Id which can
serve to easily tell manual from API submitted orders. The TWS'
tooltip elaborates further:
The callback will look like <openOrder orderId=-3,... and then you just call tws.cancelOrder(-3)
Note that you don't get orders placed previously in TWS, only those placed after the call to reqAutoOpenOrders.

Resources