-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add EditionIdCAPIMapper
#26830
Add EditionIdCAPIMapper
#26830
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -76,7 +76,7 @@ trait ApiQueryDefaults extends GuLogging { | |||
|
||||
def item(id: String): ItemQuery = CapiContentApiClient.item(id) | ||||
|
||||
def item(id: String, edition: Edition): ItemQuery = item(id, edition.id) | ||||
def item(id: String, edition: Edition): ItemQuery = item(id, EditionIdCAPIMapper.mapEditionId(edition)) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The mapping looks good to me as Content-api's Conceirge reads Just being curious, some que on this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you so much @Divs-B for the review! Re point 2,
For these reasons we would prefer to go with the mapper for now but I have created a ticket to rename the IDs as this is the best approach: And one question: Is Concierge the interface to all CAPI requests? Does that mean that all of CAPI's endpoints expect the long form id i.e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @ioannakok for your answers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding your query: Yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Team also has confirmed the same for Concierge 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @Divs-B thanks for your review! Out of an abundance of caution we checked in Kibana whether any other requests (other than most-viewed) are made to CAPI from frontend using the short edition ids of Here are few example queries to demonstrate the different frontend applications making requests to CAPI using the short form ids of either EUR form the facia app Manually updating the edition id to the long form id returns the same response so we assume the edition parameter does not actually affect the query response. Could you please confirm our understanding that the queries above do not use the edition parameter so updating the edition id to the long form should have no effect. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello. CAPI only becomes interested in the edition parameter if the query is for what looks like a network front (from days before the Fronts API existed IIRC) or an editionalised section, e.g. sport. In the examples you've linked, these appear to be mostly individual content item or tag searches, and those will ignore the edition. If you're curious about which sections are editionalised, you can go to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @JustinPinner and @Divs-B very helpful |
||||
|
||||
//Strip unnecessary leading slash in path, as this affects signing of IAM requests | ||||
def item(id: String, edition: String): ItemQuery = | ||||
|
@@ -194,3 +194,15 @@ class PreviewContentApi(httpClient: HttpClient)(implicit executionContext: Execu | |||
apiKey = contentApi.key.getOrElse(""), | ||||
) | ||||
} | ||||
|
||||
object EditionIdCAPIMapper { | ||||
def mapEditionId(edition: Edition): String = { | ||||
edition match { | ||||
case editions.Uk => "UK" | ||||
case editions.Us => "US" | ||||
case editions.Au => "AU" | ||||
case editions.International => "INTERNATIONAL" | ||||
case editions.Europe => "EUROPE" | ||||
} | ||||
} | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming because
cookieValue
is misleading. This method returns the edition from a parameter, a header or a cookie.