Use of Amadeus Trip parser API - amadeus

UPDATE : Fix one problem with the content-type of the request which has to be application/vnd.amadeus+json 🤷‍♂️ After the fix, lot of mails are not able to be parse without additional details. Amadeus support kind of confirmed me that my test mails are from providers that are not supported :/
I try to use Self-Service Trip Parser API https://developers.amadeus.com/self-service/category/trip/api-doc/trip-parser
I did some testing using confirmation emails from well-known brand like Booking or Oui SNCF but with no success and generally got 500 generic errors.
What I do is :
go to gmail, download the message as .eml format
encode it to base 64 base64 -i mail.eml | tr -d '\n' | pbcopy
create the payload to send to Amadeus using own Amadeus Swagger but got 500 errors in most case
{
"data": {
"type": "trip-parser-job",
"content": "<paste mail content>"
}
}
{
"errors": [
{
"code": "38189",
"title": "Internal error",
"detail": "An internal error occurred, please contact your administrator",
"status": "500"
}
]
}
In best case, the job is created, but the status is failure after a few minutes
Only using mail PDF attachment seems to work sometimes.
My questions are simple :
do any of you make it works reliably ?
is there any additional information on support input format or providers ?
is there any worthwhile alternative ?

Related

QnA Maker API - Locking up after updates

I'm deleting various records from my QnA Maker KB via the Invoke-RestMethod PowerShell command and then adding some new QnA's with the same command.
I'm finding that sometimes it works and sometimes I get a 400 Bad Request response with the details:
Invoke-RestMethod : {
"error": {
"code": "BadArgument",
"message": "Invalid input. See details.",
"details": [
{
"code": "ValidationFailure",
"message": "Kb: <KB Number> is already being updated by Operation: 9766ff66-f950-41ed-b0de-b77d8bc78c23. Please wait for it to complete.",
"target": "ConcurrentUpdates"
}
]
}
}
I don't think this is related to the JSON I'm sending as it doesn't fail or work consistently. When I get this response my QnA Maker is then locked from any changes for ~1 hr. I also get the same error if I click Save and Train in the QnA Maker portal.
Any ideas what's happening or how I can debug this?
Thank you Steven for pointing me in the right direction.
I tested copying and pasting the JSON body of my requests and sending via Postman and it worked perfectly. Following that I did lots of testing with Invoke-RestMethod and HTTPBin and found that one QnA I was trying to add had characters with accents. Invoke-RestMethod was converting the whole JSON body to Base64 in this case for some reason. Including "charset=utf-8" on the content type fixed it.
I think the locking out for an hour was just a symptom of me sending multiple bad requests to the QnA Maker api...

Question about testIamPermissions method in Billing API

I'm trying to use cloudbilling.billingAccounts.testIamPermissions in the APIs Explorer, but I get an error.
API URL
https://developers.google.com/apis-explorer/?hl=ko#p/cloudbilling/v1/cloudbilling.billingAccounts.testIamPermissions?resource=billingAccounts%252F01183E-6A3E97-BE2C7A&resource=%257B%250A%257D&_h=1&
Error Result
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
The error message appears as 'Request contains an invalid argument', so the value entered in resource seems to be incorrect.
I entered billingAccounts / {billingAccountID} for resource, but I do not know why I get an error.
{billingAccountID} has entered the billing account ID you are using.
What value should be put in the resource?
You need to use your full ID "billingAccounts/012345-567890-ABCDEF`" as an string. Also avoid to share your private information for security reasons use examples instead.
Confirm that the other options of the API works for you.

Wit AI response for API requests

I'm using wit ai for a bot and I think it's amazing. However, I must provide the customer with screens in my web app to train and manage the app. And here I found a big problem (or maybe I'm just lost). The documentation of the REST API is not enough to design a client that acts like the wit console (not even close). it's like a tutorial of what endpoints you can hit and an overview of the parameters, but no clean explanation of the structure of the response.
For example, there is no endpoint to get the insights edge. Also and most importantly, no clear documentation about the response structure when hitting the message endpoints (i.e. the structure the returned entities: are they prebuilt or not, and if they are, is the value a string or an object or array, and what the object might contain [e.g. datetime]). Also the problem of the deprecated guide and the new guide (the new guide should be done and complete by now). I'm building parts of the code based on my testing. Sometimes when I test something new (like adding a range in the datetime entity instead of just a value), I get an error when I try to set the values to the user since I haven't parsed the response right, and the new info I get makes me modify the DB structure at my end sometimes.
So, the bottom line, is there a complete reference that I can implement a complete client in my web app (my web app is in Java by the way and I couldn't find a client library that handles the latest version of the API)? Again, the tool is AWESOME but the documentation is not enough, or maybe I'm missing something.
The document is not enough of course but I think its pretty straightforward. And from what I read there is response structure under "Return the meaning of a sentence".
It's response in JSON format. So you need to decode the response first.
Example Request:
$ curl -XGET 'https://api.wit.ai/message?v=20170307&q=how%20many%20people%20between%20Tuesday%20and%20Friday' \
-H 'Authorization: Bearer $TOKEN'
Example Response:
{
"msg_id": "387b8515-0c1d-42a9-aa80-e68b66b66c27",
"_text": "how many people between Tuesday and Friday",
"entities": {
"metric": [ {
"metadata": "{'code': 324}",
"value": "metric_visitor",
"confidence": 0.9231
} ],
"datetime": [ {
"value": {
"from": "2014-07-01T00:00:00.000-07:00",
"to": "2014-07-02T00:00:00.000-07:00"
},
"confidence": 1
}, {
"value": {
"from": "2014-07-04T00:00:00.000-07:00",
"to": "2014-07-05T00:00:00.000-07:00"
},
"confidence": 1
} ]
}
}
You can read more about response structure under Return the meaning of a sentence

Error on Paysafe Card Payment API?

This may sound stupid but I keep getting this error for every request that I make for the Card Payments API.
{
"error": {
"code": "5270",
"message": "The credentials provided with the request do not have permission to access the data requested.",
"links": [
{
"rel": "errorinfo",
"href": "https://developer.optimalpayments.com/en/documentation/cardpayments/error-5270"
}
]
}
}
The error seems to indicate that I do not have permission to do something. Is this an access issue as I think I am using the proper key? Has anyone ever seen this error with Paysafe?
#Crazyshezy is correct. Write to Paysafe with the key that you are using and they will be able to isolate what permissions that you have or may not have with your API key.
i was getting same error. It was due to card expiry year. It should be 4 digit year(e.g 2017) but i was sending 2 digit year(17).

Can't create replies to some existing youtube comments

I have a software, which allows you to create a reply to a comment on your youtube video. Therefore I use the youtube API v3 comments.insert method.
POST https://www.googleapis.com/youtube/v3/comments?part=id%2Csnippet&access_token=[access_token]
{
"snippet": {
"parentId": "parentId",
"textOriginal": "test message"
}
}
Most of the time the requests are successful. But for some comments I can't create replies this way. The API always returns:
{
"error": {
"errors": [
{
"domain": "youtube.comment",
"reason": "processingFailure",
"message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid. Check the structure of the <code>comment</code> resource in the request body to ensure that it is valid.",
"locationType": "other",
"location": "body"
}
],
"code": 400,
"message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid. Check the structure of the <code>comment</code> resource in the request body to ensure that it is valid."
}
}
I'm using a valid access token and the parentId is valid, too, because I can retrieve it through the API.
I took a look at the successful and failing requests, but didn't find any difference. So I assume that the request input isn't invalid as it is mentioned in the error message.
In my opinion this error isn't a transient error, because the same requests are still failing after some days.
I also tried to create a reply on such a comment through the API Explorer but the result was the same.
Does anyone have the same problems or am I doing something wrong?
When I go to the video and look at the comments directly, the comment with ID z13tjxdqnuygy1lga04cilcqxqipg1zbtbs has a "reply" option under it, while the comment with ID z13rgftjgw3bulyou04ccfnbjofztxg54yo0k does not. It seems that the user posted the comment via their Google+ page and disabled replies to their posts.