How to access Delta Comfort+ price and seatmap with Amadeus APIs? - amadeus

I need help retrieving flight offers and seat map information for Delta Comfort+ seats using the Amadeus flight APIs.
I've seen Comfort+ described as "both fare and ancillary seat purchase options" that are "booked in W and S classes", and this site gives methods for recognizing a Comfort+ offer using the fare basis code.
I think I've tried most or all of the parameters in the Flight Offers Search API (shopping/flight-offers) and haven't been able to get back any results I can identify as Comfort+ using those methods.
I've also tried the upsell API (/shopping/flight-offers/upselling), which I can get to return main cabin offers based on a submitted basic economy offer, but nothing higher.
And in the seatmap API (/shopping/seatmaps), I'm only seeing seats in the economy section and not those in the Comfort+ section... probably because I've only been able to submit economy flight offers to it.
If anyone could point me in the right direction, I'd really appreciate it. Thanks!
---- added in response to jabrena's request --------------------------
After a bunch of trial and error, I was able to locate a Comfort+ offer and retrieve a seatmap of the Comfort+ section of the main cabin. The steps were:
search flight-offers using pricingOptions.noPenaltyFare=true or pricingOptions.refundableFare=true. (Without these pricingOptions, the returned offers couldn't be upgraded to comfort+ using the upselling API)
submit one of the returned flight offers to the upselling API
locate a returned offer with a fareDetailsBySegment.class of S or W and submit it to the seatmap API.
Here is the flight-offers call (using the Node SDK). The upselling and seatmap calls were populated as I described above
amadeus.shopping.flightOffersSearch.post(JSON.stringify({
currencyCode: "USD",
originDestinations: [
{
id: "1",
originLocationCode: 'MSP',
destinationLocationCode: 'ARN',
departureDateTimeRange: {
date: '2022-04-14'
}
},
{
id: "2",
originLocationCode: 'ARN',
destinationLocationCode: 'MSP',
departureDateTimeRange: {
date: '2022-04-18'
}
}
],
travelers: [
{
id: "1",
travelerType: "ADULT"
}
],
sources: [
"GDS"
],
searchCriteria: {
maxFlightOffers: 200,
additionalInformation: {
brandedFares: true
},
allowAlternativeFareOptions : true,
flightFilters: {
carrierRestrictions: {
includedCarrierCodes: [
"DL",
"AF",
"KL"
]
}
},
pricingOptions: {
noPenaltyFare: true
}
}
})).then(function (response) {
resolve(response);
}).catch(function (response) {
resolve(JSON.stringify(response));
});
Couple points:
I tried the offers API's pricingOptions in a bunch of different combinations. Using pricingOptions.noPenaltyFare=true or pricingOptions.refundableFare=true were the only ways I could get back offers with the classes that would cause the upselling API to return Comfort+ offers
using the PREMIUM_ECONOMY cabinRestriction returned offers that are a class above Comfort+, with seats located outside of the Comfort+ section
using pricingOptions = 'noRestrictionFare=true' returns class Y (full fare), but submitting that to seatmap returns only the non-comfort+ seats, and submitting a Y class offer to the upsell API returned only 1st class (Delta One) and economy amenities... not a Comfort+ option
This feels a little random, and I'm not confident that this is the best way to approach this... Is there any documentation that can help reduce the guesswork?
Thanks!

Related

HubSpot API — Automatically bulk delete tasks/contacts/deals (or anything) using Make

I would like to automatically bulk delete all tasks older than a month in HubSpot (we have more than 10,000 tasks!), instead of doing it one by one. I tried looking on the internet but it doesn’t seem that HubSpot has any functionalities like it. Thus, I tried to implement such scenario using Make (formerly Integromat) unsuccessfully.
Answering to my question for knowledge purposes.
I managed to create a scenario allowing me to automatically bulk delete tasks (or anything) based on a certain set of criteria using Make (formerly Integromat). I had to use HubSpot’s API and Flow Control tools to achieve such result.
The scenario looks like the following:
Module 1: API Call
Search for all tasks based on a certain set of criteria (here, all tasks created before the last 30 days).
If you wish to search for another object (such as contacts or deals), you can take a look at the CRM Search API for all available search requests. You can also browse through the Properties API to get a comprehensive list of available properties.
URL: /crm/v3/objects/tasks/search
Method: POST
Body:
{
"limit": "5",
"properties": [
"hs_task_subject",
"hs_task_type",
"hs_timestamp"
],
"filterGroups": [
{
"filters": [
{
"propertyName": "hs_task_status",
"operator": "EQ",
"value": "NOT_STARTED"
},
{
"propertyName": "hs_createdate",
"operator": "LT",
"value": "{{formatDate(addDays(now; -30); "x")}}"
}
]
}
]
}
Module 2: Repeater
Initial Value: 0
Repeats: {{if(module1.body.total = null; 1; module1.body.total / 100)}} (if total is less than 100, do not repeat)
Step: {{ifempty(module1.body.paging.next.after; 100)}} (automatically sets it to the first module’s after value, otherwise to 100 if after` value is empty)
You can find out more about properties and search limitations here and here. Basically, the repeater allows you to loop over all HubSpot pages.
Module 3: Sleep
Sleep module to prevent RateLimitError
Module 4: API Call
Same as Module 1, except that you must add an after parameter to include the repeater’s value.
+ "after": "{{module2.i}}"
Module 5: Iterator
Iterate over Module 4’s results array: {{module4.body.results}}.
Module 6: API Call
Delete tasks using the ID returned by the iterator.
{
"inputs":[
{
"id":"{{module5.id}}"
}
]
}
Voilà !

How do I join and project a multi-map index?

I'm struggling to get my head around this one and I know the way to do this is through a custom index. Essentially, I have several collections that share some common properties, one of which is "system id" which describes a many-to-one relationship, e.g.
// Id() = "component:a"
{
"Name": "Component A"
"SystemId": "system:foo"
}
// Id() = "resource:a"
{
"Name": "Resource A",
"SystemId": "system:foo"
}
So these are two example objects which live in two different collections, Components and Resources, respectively.
I have another collection called "Notifications" and they have a RecipientID which refers to the Id of one of the entities described above. e.g.
// Id() = "Notifications/84-A"
{
"RecipientID": "component:a",
"Message": "hello component"
}
// Id() = "Notifications/85-A"
{
"RecipientID": "resource:a",
"Message": "hello resource"
}
The query that I want to be able to perform is pretty straight forward -- "Give me all notifications that are addressed to entities which have a system of ''" but I also want to make sure I have some other bits from the entities themselves such as their name, so a result object something like this:
{
"System": "system:foo",
"Notifications": [{
"Entity": "component:a",
"EntityName": "Component A",
"Notifications": [{
"Id": "Notifications/84-A",
"Message": "hello component"
}]
}, {
"Entity": "resource:a",
"EntityName": "Resource A",
"Notifications": [{
"Id": "Notifications/85-A",
"Message": "hello resource"
}]
}]
}
Where I am with it right now is that I'm creating a AbstractMultiMapIndexCreationTask which has maps for all of these different entities and then I'm trying to use the reduce function to mimic the relationship.
Where I'm struggling is with how these map reduces work. They require that the shape is identical between maps as well as the reduce output. I've tried some hacky things like including all of the notifications as part of the map and putting dummy values where the properties don't match, but besides it making it really hard to read/understand, I still couldn't figure out the reduce function to make it work properly.
How can I achieve this? I've been digging for examples, but all of the examples I've come across make some assumptions about how references are arranged. For example, I don't think I can use Include because of the different collections (I don't know how Raven would know what to query), and coming from the other direction, the entities don't have enough info to include or load notifications (I haven't found any 'load by query' function). The map portion of the index seems fine, I can say 'give me all the entities that share this system, but the next part of grabbing the notifications and creating that response above has eluded me. I can't really do this in multiple steps either, because I also need to be able to page. I've gone in circles a lot and I could use some help.
How about indexing the related docs ?
Something like this (a javascript index):
map("Notifications", (n) => {
let c = load(n.RecipientID, 'Components');
let r = load(n.RecipientID, 'Resources');
return {
Message: n.Message,
System: c.SystemId || r.SystemId,
Name: c.Name || r.Name,
RelatedDocId: id(c) || id(r)
};
})
Then you can query on this index, filter by the system value, and get all matching notifications docs.
i.e. sample query:
from index 'yourIndexName'
where System == "system:foo"
Info about related documents is here:
RavenDB Demo
https://demo.ravendb.net/demos/csharp/related-documents/index-related-documents
Documentation
https://ravendb.net/docs/article-page/5.4/csharp/indexes/indexing-related-documents

Google Vision Text Detection returns too much unnecesary data

When using Google Vision to run text detection on a menu, the response from their API is way too large and returns way too much data that I don't need. I just want the text from the menu, not all the coordinates that come with the response. I can't find anything about narrowing down the response in any documentation i've read. Does someone know how to specify what fields get returned in the response?
Heres my request:
POST: https://vision.googleapis.com/v1/images:annotate?key=<MY_KEY>
BODY:
{
"requests": [
{
"image": {
"content": "...base64-encoded-image-content..."
},
"features": [
{
"type": "TEXT_DETECTION"
}
]
}
]
}
I figured it out. I could not find any documentation on how to do this, I had to just guess for like half an hour. If someone knows of any documentation on this let me know.
Anyway you can use the "fields" parameter to narrow down the response like so:
POST: https://vision.googleapis.com/v1/images:annotate?key=<MY_KEY>&fields=responses.fullTextAnnotation.text
This will only return the menu text from the Google Vision text detection API

Does the JIRA REST API require submitting a transition ID when transitioning an issue?

If I POST an issue transition like this:
{
"fields" : {
"resolution" : {
"name" : "Fixed"
}
}
}
...I get this error:
{
"errorMessages" : ["Missing 'transition' identifier"],
"errors" : {}
}
This seems to imply that I need to include a transition ID along with my list of changed fields. https://stackoverflow.com/a/14642966/565869 seems to say the same. Fine.
However, transition IDs appear to be global. It's not enough to look up the highest transition ID for this issue and increment it; such an ID is probably in use elsewhere. At some expense, I could get the highest transaction ID used anywhere in the system; this might be 68,000 at this moment. But if I were then to use transaction ID 68,001 there's a real chance that a GUI user would attempt a transition of their own and use this ID before I could.
I could use transaction IDs in the range of 1,000,001 and up, but if the JIRA web GUI uses the highest previously used transaction ID when generating new IDs I'll just collide in this range instead of the 68,000 range. I could use 69,000 and trust that there won't be a thousand transitions in the length of time it takes to get the highest transaction ID.
These both seem terribly clumsy, however. Is there no way to post a transition and let JIRA generate its own unique ID? I don't need to retrieve the generated IDs, I just want to update issues' statuses and resolutions.
You're getting mixed up a bit. So lets see if I can explain it better for you.
To transition a JIRA Issue, you use the Transition ID to identify what transition to apply to the issue. You aren't specifying an ID for a transaction or a transition ID to identify that the transition occurred, JIRA takes care of this for you.
The easiest way to understand it is to see it.
So first you can look at what transitions are available to an Issue by doing a GET to the API Call:
/rest/api/2/issue/${issueIdOrKey}/transitions
Example:
/rest/api/2/issue/ABC-123/transitions
Which will show something like this:
{
"expand": "transitions",
"transitions": [
{
"id": "161",
"name": "Resolve",
"to": {
"description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.",
"iconUrl": "https://localhost:8080/images/icons/statuses/resolved.png",
"id": "5",
"name": "Resolved",
"self": "https://localhost:8080/rest/api/2/status/5"
}
}
]
}
So you can see only 1 transition is available for issue ABC-123 and it has an ID of 161.
If you were to browse to that JIRA Issue through the GUI, you would see only 1 Transition available and it would match the API Call. In fact if you inspected the element you should see it having an a tag and in the href something like action=161
So should you want to transition this issue, you'll need to do a POST to the following URL:
/rest/api/2/issue/ABC-123/transitions
With JSON like this:
{
"update": {
"comment": [
{
"add": {
"body": "Bug has been fixed."
}
}
]
},
"fields": {
"assignee": {
"name": "bob"
},
"resolution": {
"name": "Fixed"
}
},
"transition": {
"id": "161"
}
}
Which uses the transition ID found from the call that shows all transitions. I also update the resolution and assignee and add comments at the same time.
That make a bit more sense?

Get User Stories for each Release Feature Lookback API

I need to add some customization to BurnDownApp.
and I want to retrieve all User Stories for Release from 'Release Combobox' + All Users stories which linked to Portfolio Item features which linked to release.
In default implementation I can retrieve only User Stories which linked to Release:
find: {
"_TypeHierarchy": { '$in' : [ -51038] },
"Children": null
}
I tried to use this query:
find:{
$and:
[{"_TypeHierarchy": -51038, "Children": null},
{"_TypeHierarchy": { '$in' : [ -51038, -51006 ] },
"Children": null
"Feature.Release.Name": "%ReleaseName%"}]
}
but it doesn't work
How I should change query for get needed data?
Link to BurnDownApp on github: https://github.com/RallyApps/app-catalog/tree/master/src/apps/charts/burndown
Even though a WS API query (Feature.Release.Name = "r3") will work:
https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12345&query=(Feature.Release.Name = "r3")
This will not work in Lookback API.
This Lookback API query "Feature":7777 will work. In this example 7777 is ObjectID of a feature:
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12345/artifact/snapshot/query.js?find={"_ProjectHierarchy":22222,"_TypeHierarchy":"HierarchicalRequirement","ScheduleState":"Accepted","Feature":7777,"_PreviousValues.ScheduleState":{ "$lt":"Accepted"}},sort:[{"ObjectID": 1},{_ValidFrom: 1}]&fields=["Name","ScheduleState","PlanEstimate","Release"]&hydrate=["ScheduleState"]
If you want to get features in the custom app dynamically based on a release combobox selection you may:
Use wsapi data store to find those features (get their OIDs), and then
Use snapshot to get historical data on stories that associated with features. Filtering them based on "Feature": {$in:[7777,8888,9999]} in the find should work.