What is the REST API URL to get "Linked Defects" from Test in ALM - alm

I was not able to get the linked defects from the test, Is there a way to get it through REST API ?

You have to use the Cross-Relations and approach it from the defects side:
.../defects?query={test.id[>=1 And NOT = 5]}
This one will give you all the defects that are connected to the tests with id 1-4.
More info on Cross-Filters here

I use multiple query params to get the defects only for relevant test cycle with following request (otherwise I was fetching too many defects):
.../defects?query={test.id[12345];test-instance.id[6789012]}

Related

500 error when using the shopping.flightDates.get endpoint

Using your API for an fun app I am developing and I just started using your eendpoints, This particular endpoint gives me this responseError:
body: '{"errors":[{"status":500,"code":141,"title":"SYSTEM ERROR HAS OCCURRED","detail":"ORIGIN AND DESTINATION NOT ALLOWED FOR AMA4DEV EXTREME SEARCH REQUESTS ON ENVIRONMENT"}]}',
The endpoint I am hitting is:
amadeus.shopping.flightDates.get({
origin : 'PHX',
destination : 'MEX'
}).then(function(response){
console.log(response.data);
}).catch(function(responseError){
console.log(responseError.response);
});
To make sure it was not something with the auth token/secret I made sure to make a test call using your example on github that works which was:
amadeus.shopping.flightDates.get({
origin : 'MUC',
destination : 'MAD'
}).then(function(response){
console.log(response.data);
}).catch(function(responseError){
console.log(responseError.response);
});
No problem in hitting that endpoint. Thank you again for looking into this
If you use the test environment: it is free of charge but limited (limited number of API calls you can do per month and limited set of data (a subset of production data)). For each API you can find the data collection available here.
For Flight Cheapest Date Search API, the test environment doesn't have data for PHX as origin.
I tried in production and it does return data. Please note that Flight Inspiration Search and Flight Cheapest Date Search are built on top of a pre-computed cache (in production). As they are inspirational APIs we do not offer all pairs of origin-destination but only the most searched all over the world. If you want to get the full list of origin-destination pairs (even smaller cities), you need to use the Flight Offers Search API.

How can I add custom operation to Azure Application Insights's Performance tab?

We have a GraphQL api that runs on .Net Core. Since all queries are made to the /graphql endpoint we only get one operation "POST /graphql" on the performance page of Azure Application Insights while a REST API would have allowed Aplication Insights to automatically give us the performance per endpoint (ex. GET /users, POST /events, etc...).
To still get performance indicators I added custom Telemetry to our code. When the code to retrieve the users is called I do this:
RequestTelemetry requestTelemetry = new RequestTelemetry
{
Name = "UsersRequest"
};
var operation = _telemetryClient.StartOperation(requestTelemetry);
And when it is all done I do this:
operation.Telemetry.Success = true;
_telemetryClient.StopOperation(operation);
return result;
Then I can see the dependency calls wrapped up inside a "UsersRequest" when I open a "POST /graphql" operation like the screenshot below (imagine that "CustomMiddleware" says "UsersRequest"):
That's already a great help, it's much more clear than having all DB requests under each other without structure.
The only thing missing it's that I can't see the "UsersRequest" or "CustomMiddleware" on the performance page as an operation itself. That would be a massive help, the performance page gives amazing insights. It would be super helpful to be able to see that "UsersRequest" has been called 500 times in the last 24h, that the performance has been degrading in the last 7 days or that the average duration is 50ms.
Thank you!

Authorize.net Error when adding new paymentProfile - code: E00114, Invalid OTS Token

we're trying to add a new customerPaymentProfile for an existing customerProfile. we're patterning our code on the github sample provided
https://github.com/AuthorizeNet/sample-code-node/blob/master/CustomerProfiles/create-customer-payment-profile.js
the only difference is that, we don't pass CC details to our servers. instead, we pass opaqueData from frontend. on Initial customerProfile creation(with a single payment profile) it works w/c is good. but if we try to add a new paymentProfile(using a new opaqueData) we get the error code: E00114, Invalid OTS Token.
the official documentation regarding error code doesn't say much
And it seems like there's a few different cases, where it throws this error code
Using Accept.js
https://community.developer.authorize.net/t5/Integration-and-Testing/E00114-Invalid-OTS-Token/td-p/58879
https://community.developer.authorize.net/t5/Integration-and-Testing/E00114-Invalid-OTS-Token/td-p/59314
Our Case(node.js SDK)
https://community.developer.authorize.net/t5/Integration-and-Testing/Error-while-adding-new-paymentProfile-quot-code-quot-quot-E00114/td-p/69872
Others
https://community.developer.authorize.net/t5/Integration-and-Testing/Intermittent-Invalid-OTS-Token-Errors-E00114/td-p/57509
https://community.developer.authorize.net/t5/Integration-and-Testing/E00114-Invalid-OTS-Token-error-generates-while-creating-ARB/td-p/68685
We also tried to delay the transaction at least 7 seconds, before using the opaqueData maybe to allow their systems to sync as suggested here to receive the same error message.
Anyone ever encountered something like this before?
Any form of help would be highly appreciated.
We were doing something wrong, by doing trial and error(via API) to determine if a customer exists or not. hence hitting api once or twice resulting to an invalid token (error on 2nd call)
So we tried to create a customerProfile, w/ customerPaymentProfile & this will throw error if customerProfile already exist(if its a duplicate email). Whats good here, is that customerProfileId comes with the error payload.
We though of using customerProfileId from error payload, to create a new payment profile for the customer, giving us some edge by reducing one DB call on our system.
The issue with our strategy though, is that opaqueData will expire, when we use it to create customerProfile(w/ payment profile) even though the request failed.
So resolution is to save customer info in our system, and check if it's a returning customer or not. If it is, then get customerProfileId from db, and create new customerPaymentProfile on authorize.net
One could also create customerProfile first, w/o the customerPaymentProfile. if this transaction fails, then at least you haven't used the opaqueData yet and you get the customerProfileId w/o doing any query on your db. So when you try to create a new customerPaymentProfile, you won't get error code E00114 since opaqueData isn't used yet.
lessons learned the hard way for us, but hopefully it helps someone.

Multiple api call

I'm trying to build a nodejs app that runs and if statement to query multiple api's to return a result. Example, running yelps api first, if it finds then break, else continue query another api such as google places or white pages api until it finds a result.
I am passing in either a name of a business, address to return a telephone number. the results expected are in json. I am drawing a blank.
ideas?
so the way to achieve this is you should be able to make http req from your server side and when a result comes with a response then you should check that response. If your requested answer is not in it then you should keep on trying other API end points untill u come across with a suitable response..
so here are some npm packages to achieve this simply
http - node js built in package
Axios - here
request - here
try using one of these packages .. I would use axios .. read their doc and try to do it .. It should clear somethings out for you

Feathersjs filter results

I have created a node/feathers project using this chat application guide as a base. It's working great, but now I would like to filter the results the api is giving. For example, when user makes GET request to /messages I would like the response to include only the messages that the authorized user has created, not anyone else's messages. Auth is working correctly in the api and message items have the userId who created the message, but I just don't understand what and where I'm supposed to do to filter the messages according to the user id. After hours of googling I couldn't find anything related to this or anyone even asking the question, so what am I missing here?
You can do a manual filtering. Both on before and after hooks. How to use hooks.
In before hooks you can create a function that update your query object to only get/find data it owns.
hook.params.query = { ... , ownedBy: hook.params.user._id }
Or do result filtering in after hooks, you have the hook.result which is the only thing you can manipulate in the after hooks. Then you can use Array.prototype.filter() to filter the results the user gets.

Resources