TFS Error TF401320 While Trying to reopen Bug Using rest API - rest

Hi I am trying to reopen (Close to New State) Bug using REST API batch operation in TFS .
My patch document is as below
[
{
"method":"PATCH","uri":"/_apis/wit/workItems/309?api-version=1.0","headers":{
"Content-Type":"application/json-patch+json"
},
"body":
[
{
"op":"add",
"path":"/fields/System.State",
"value":"New"
},
{
"from":"add",
"op":"add",
"path":"/fields/System.Tags",
"value":"abc,cde,efg"
}
]
}
]
I am getting below error,I find not much information in documentations Please be kind enough to help me to rectify this issue.
TF401320: Rule Error for field Resolved Reason. Error code: HasValues, LimitedToValues, SetByRule, InvalidNotEmpty.
p.s : similar method work fine to modify "New" Bug "Close"

You need to clear ResolvedReason field value:
[
{
"op":"add",
"path":"/fields/System.State",
"value":"New"
},
{
"op":"add",
"path":"/fields/Microsoft.VSTS.Common.ResolvedReason",
"value":""
}
]

Related

How to connect magento 2.3.5-p2 with magento PWA studio 8

I need connect Magento 2.3.5-p2 with Magento PWA studio 8. When I try to run PWA I get the error:
Error: Cannot query field "availableStores" on type "Query". (... 1 errors total) at fetch.then.catch.then.json (/home/michal/magento2/pwa-studio/packages/pwa-buildpack/lib/Utilities/graphQL.js:33:23) at process._tickCallback (internal/process/next_tick.js:68:7).
I know these versions are incompatible, but maybe someone had to do it as well and has some suggestions on how to do it.
#Michal i had similar issue with my magento store and in my case it was klarna payment was causing some issue.
you may easily debug it by viewing in packages/pwa-buildpack/lib/Utilities/graphQL.js:32
Body :
`{"query":"query availableStoresConfigData {\n availableStores {\n code\n id\n store_name\n default_display_currency_code\n }\n}\n"}`
Response should be like this:
{
"data": {
"availableStores": [
{
"code": "default",
"id": 1,
"store_name": "Default Store View",
"default_display_currency_code": "USD"
}
]
}
}

"The agent returned an empty TTS" when action is not opened separately to asking an intent

When I invoke the skill with 'okay Google, ask {skillname} to {utterance}' I get the response 'The agent returned an empty tts" and the conversation closes. It doesn't even seem to hit my backend - I've tried hosting the backend code on both a local server and on AWS and the same issue happens in both cases. There's no log of the request being made either on Stackdriver on Google or on CloudWatch on AWS. The only response I get is the following in the debug tab:
{
"response": "The agent returned an empty TTS.",
"expectUserResponse": false,
"conversationToken": "EosDS2o4d0...",
"audioResponse": "",
"ssmlMarkList": [],
"debugInfo": {
"sharedDebugInfoList": [
{
"name": "Response Validation",
"debugInfo": "The agent returned an empty TTS.",
"subDebugEntryList": []
}
],
"conversationBuilderExecutionEventsList": []
},
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "The agent returned an empty TTS."
}
}
],
"suggestionsList": [],
"agentLogoUrl": ""
},
"clientError": 0,
"is3pResponse": true,
"clientOperationList": [],
"projectName": "",
"renderedHtml": ""
}
Nothing in any of the other tabs. When I try invoking the phrases in the same way on my phone, I just see a loading symbol and again nothing in the logs to say it's even hitting the backend.
Weirdly, this doesn't happen when I say 'okay Google, talk to {skillname} {utterance}' - this works absolutely fine.
All the intents work perfectly well when I've opened my action first, and then invoke them. I've built this using Jovo and published on Alexa also and the problem is only happening on Google.

Inspect element - how to get parameters sent to a redirected page and simulate it with postman?

In this link there is a quiz when you click on Start Now:
https://www.clinique.com/diagnostics
After the quiz finished, it posts data to a link and immediately redirects to another page with quiz results.
How to find out what data have been posted to the page and is there a way to simulate the final results with the Postman?
Looks like what you're looking for is the Postman Interceptor feature. It allows you to capture and inspect all the requests made from the browser/system you configure it to proxy to.
Then, once your request was captured, and after a bit of filtering (it'll capture every single request made to the server, not only the POST you're interested into) You will be able to replicate it with the Postman client like you'll do with a regular request. e.g. with the quiz you posted:
You'll find the data posted being sent as x-www-form-urlencoded (what a mess!) on a JSON key with the value:
{
"ProfileName":"04-NA-USA ELC Online 4.05.2017",
"QuizVersion":6,
"QuizAnswers":[
{
"attributeName":"welcome",
"attributeRecapValuesLocalized":"mens_concerns",
"recapColumn":1
},
{
"attributeName":"mens_concerns",
"attributeRecapValuesLocalized":"Eye Area",
"recapColumn":0
},
{
"attributeName":"mens_age",
"attributeRecapValuesLocalized":"50 - 59",
"recapColumn":1
},
{
"attributeName":"mens_eye_area_where",
"attributeRecapValuesLocalized":"Lines/Wrinkles",
"recapColumn":0
},
{
"attributeName":"mens_skintype",
"attributeRecapValuesLocalized":"oily-shiny,tight-uncomfortable",
"recapColumn":0
},
{
"attributeName":"mens_sensitivity_frequency",
"attributeRecapValuesLocalized":"Rarely",
"recapColumn":1
},
{
"attributeName":"mens_sensitivity_redness",
"attributeRecapValuesLocalized":"No",
"recapColumn":1
},
{
"attributeName":"recap",
"attributeRecapValuesLocalized":"",
"recapColumn":1
}
],
"SkinType":"2",
"SKUs":[
{
"Eye Area":[
"7YXH-01",
"7ELF-01",
"6TCR-01"
]
},
{
"Daily Care":[
"ZE4L-01",
"ZF7E-01",
"65EM-01",
"Z219-01",
"Z5WW-01"
]
}
],
"UPCs":[
{
"Eye Area":[
"020714632670",
"020714506827",
"020714382742"
]
},
{
"Daily Care":[
"020714734510",
"020714744762",
"020714104726",
"020714649562",
"020714682255"
]
}
],
"Concerns#1":"Eye Area",
"Concerns#2":"Daily Care",
"UsageOrderSKUs":[
"ZE4L-01",
"ZF7E-01",
"65EM-01",
"7YXH-01",
"Z219-01",
"Z5WW-01",
"7ELF-01",
"6TCR-01"
],
"UsageOrderUPCs":[
"020714734510",
"020714744762",
"020714104726",
"020714632670",
"020714649562",
"020714682255",
"020714506827",
"020714382742"
]
}

How to ask permission in Actions on Google without the SDK?

I would like to know the name of the user, however I cannot use the nodejs sdk since I use another language.
How can I ask for permission?
I would prefer a way with the normal json responses.
I hacked this minimal script to get the JSON reponse which the nodejs sdk would return:
gaction.js:
const DialogflowApp = require('actions-on-google').DialogflowApp;
const app = new DialogflowApp({
request: {
body: {
result: {
action: 'Test',
contexts: []
}
},
get: (h) => h
},
response: {
append: (h, v) => console.log(`${h}: ${v}`),
status: (code) => {
return {send: (resp) => console.log(JSON.stringify(resp, null, 2))}
}
}
});
function testCode(app) {
app.askForPermission('To locate you', app.SupportedPermissions.DEVICE_PRECISE_LOCATION);
}
app.handleRequest(new Map().set('Test', testCode));
I'm still no node.js expert so this might be not an optimal solution. When you have installed node and run the command npm install actions-on-google, this will install the necessary dependencies.
When done you just need to run node gaction which will create this output:
Google-Assistant-API-Version: Google-Assistant-API-Version
Content-Type: application/json
{
"speech": "PLACEHOLDER_FOR_PERMISSION",
"contextOut": [
{
"name": "_actions_on_google_",
"lifespan": 100,
"parameters": {}
}
],
"data": {
"google": {
"expect_user_response": true,
"no_input_prompts": [],
"is_ssml": false,
"system_intent": {
"intent": "assistant.intent.action.PERMISSION",
"spec": {
"permission_value_spec": {
"opt_context": "To locate you",
"permissions": [
"DEVICE_PRECISE_LOCATION"
]
}
}
}
}
}
}
If you send now the JSON above you will be asked from Google Home. Have fun!
The request/response JSON formats for the API.AI webhooks with Actions is documented at https://developers.google.com/actions/apiai/webhook
As you've discovered, the data.google.permissions_request attribute contains two fields regarding the request:
opt_context contains a string which is read to give some context about why you're asking for the information.
permissions is an array of strings specifying what information you're requesting. The strings can have the values
NAME
DEVICE_COARSE_LOCATION
DEVICE_PRECISE_LOCATION
If you are using Java or Kotlin there is an Unofficial SDK. It matches the official SDK api nearly exactly.
https://github.com/TicketmasterMobileStudio/actions-on-google-kotlin

Paypal Rest api: How to delete a billing plan?

The paypal developer documentation explains the steps to create and activate a Billing plan.
Is there a way to delete a billing plan?
An alternative way of deleting a BillingPlan (as per the original question) is to submit a patch request. Unfortunately this isn't too clear from looking at the API docs: https://developer.paypal.com/docs/api/payments.billing-plans/#plan_update
You want to patch the state of the BillingPlan into DELETED:
[
{
"path": "/",
"value": {
"state": "DELETED"
},
"op": "replace"
}
]
Once patched, the deleted plan no longer shows up when you list all available plans via /v1/payments/billing-plans
There is a way to DELETE a Billing Plan.
If you see the samples in the REST-PHP-SDK, there is a file named DeletePlan.php which has the code to delete the billing plan.
It goes something like this:
$createdPlan = require 'CreatePlan.php';
use PayPal\Api\Plan;
try {
$result = $createdPlan->delete($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Deleted a Plan", "Plan", $createdPlan->getId(), null, $ex);
exit(1);
}
ResultPrinter::printResult("Deleted a Plan", "Plan", $createdPlan->getId(), null, null);
return $createdPlan;
This worked for me. Hope this helps.
Thanks #smiling_warrior.
For the python API https://github.com/paypal/PayPal-Python-SDK/blob/master/samples/subscription/billing_agreements/replace.py
I used:
a=paypalrestsdk.BillingPlan.find("P-98072754CC611563JLOGIIYA")
a.replace([{"op": "replace","path": "/","value": {"state":"DELETED"}}])
Or delete all:
allplans = paypalrestsdk.BillingPlan.all()
for plan in allplans.plans:
a=paypalrestsdk.BillingPlan.find(plan.id)
a.replace([{"op": "replace","path": "/","value": {"state":"DELETED"}}])
As a complementary information about #maxxon15 answer, here's the actual code that does the DELETE on the PHP SDK :
public function delete($apiContext = null, $restCall = null)
{
ArgumentValidator::validate($this->getId(), "Id");
$patchRequest = new PatchRequest();
$patch = new Patch();
$value = new PayPalModel('{
"state":"DELETED"
}');
$patch->setOp('replace')
->setPath('/')
->setValue($value);
$patchRequest->addPatch($patch);
return $this->update($patchRequest, $apiContext, $restCall);
}
So in other terms, it simply does an update (PATCH) to the billing endpoint, as stated by #smiling-warrior
[
{
"path": "/",
"value": {
"state": "DELETED"
},
"op": "replace"
}
]