Sabre request error - sabre

I have got "Error in Request: No Pax types given" from the response of Bargin Finder Max API and here is my request:
I use json.dumps to turn the dictionary into json.
Can anyone tell me how to solve this?

Have you tried adding the passenger type to the request like the way it's shown in the sample docs?
"AirTravelerAvail" : [ {
"PassengerTypeQuantity" : [ {
"Code" : "ADT",
"Quantity" : 5,
"Changeable" : true
} ]
} ],
I would use just one ADT to test.

Related

"mapper [geo.coordinates] of different type, current_type [geo_point], merged_type [ObjectMapper]

Trying to load sample data from Kibana using the tutorial : https://www.elastic.co/guide/en/kibana/current/tutorial-load-dataset.html but facing en error of "error" : {
"type" : "illegal_argument_exception",
"reason" : "mapper [geo.coordinates] of different type, current_type [geo_point], merged_type [ObjectMapper]"
curl -H "Content-Type: application/x-ndjson" -XPOST "https://Kibana_username:Kibana_password#cd90859873ee41f2ba44736569855ac6.us-central1.gcp.cloud.es.io:9243/_bulk?pretty" --data-binary #logs.jsonl
{
"index" : {
"_index" : "logstash-2015.05.20",
"_type" : "log",
"_id" : "VLO5SWsB2ropsYqSYd-A",
"status" : 400,
"error" : {
"type" : "illegal_argument_exception",
"reason" : "mapper [geo.coordinates] of different type, current_type [geo_point], merged_type [ObjectMapper]"
}
}
}
]
}
The error that you are getting is because, in your version of logs.json, the content looks like this: {"index":{"_index":"logstash-2015.05.18","_type":"log"}} but if you read the documentation:
Indices created in Elasticsearch 6.0.0 or later may only contain a single mapping type. Indices created in 5.x with multiple mapping types will continue to function as before in Elasticsearch 6.x. Types will be deprecated in APIs in Elasticsearch 7.0.0, and completely removed in 8.0.0.
So if you change the file content like this: {"index":{"_index":"logstash-2015.05.18"}}, it would work properly.
But in the latest update of this source file, this error is fixed.

Artifactory aql: find builds of job with given property

I am trying to query which build number(s) produced artifacts from build foo with artifact property vcs.Revision=aabbccddee123456.
In Artifactory 5.1.3.
I was trying like this so far:
curl -u user:apikey -i -X POST https://artifactory.foobar.com/artifactory/api/search/aql -H "content-type:text/plain" -T query.json
query.json:
builds.find(
{
"module.artifact.item.repo":"snapshot-local",
"name":"foo",
"module.artifact.item.#vcs.Revision":"aabbccddee123456"
}
)
However, none of these 3 lines seem individually correct:
builds.find({"module.artifact.item.repo":"snapshot-local"})
returns nothing,
builds.find({"name":"foo"})
returns the same empty response,
builds.find({"module.artifact.item.#vcs.Revision":"aabbccddee123456"}) also returns this:
{
"results" : [ ],
"range" : {
"start_pos" : 0,
"end_pos" : 0,
"total" : 0
}
}
What am I doing wrong here? I do see in the webapp the builds I published with this name, and with the correct artifact properties.
Here's a working solution that will give build numbers (since giving admin rights to query builds is not a solution for us):
query.json:
items.find(
{
"repo":"snapshot-local",
"artifact.module.build.name":"foo",
"artifact.item.#vcs.Revision":"aabbccddee123456"
}
).include("artifact.module.build.number")
This returns a list of all the artifacts that were built with the relevant properties, with the build number attached, e.g:
{
"results" : [ {
"repo" : "snapshot-local",
"path" : "foo/42",
"name" : "a.out",
"type" : "file",
"size" : 123456789,
"created" : "2018-07-05T12:34:56.789+09:00",
"created_by" : "jenkins",
"modified" : "2018-07-05T12:34:56.789+09:00",
"modified_by" : "jenkins",
"updated" : "2018-07-05T12:34:56.789+09:00",
"artifacts" : [ {
"modules" : [ {
"builds" : [ {
"build.number" : "42"
} ]
} ]
} ]
},
[SNIP]
}
],
"range" : {
"start_pos" : 0,
"end_pos" : 30,
"total" : 30
}
}
I can then parse this to extract build.number.
Certain AQL queries requires a user with admin permissions.
To ensure that non-privileged users do not gain access to information without the right permissions, users without admin privileges have the following restrictions:
The primary domain in the query may only be item.
The following three fields must be included in the include directive: name, repo, and path.
In your case, you are using the build domain in the query which requires admin permissions

Artifactory quick search not filtering by repo

I am using Artifactory 4.8.0 (OSS)
I have deployed artifacts to 2 repos: libs-devel and libs-release-candidates.
When I execute
$ curl -u denham:password -X GET https://artifactory.server/artifactory/api/search/artifact?name=MyPackage&repos=libs-devel
The response I receive is:
"results" : [ {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-devel/com/acme/MyPackage/17.10.1-SNAPSHOT/MyPackage-17.10.1-20170908.092803-1.pom"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-devel/com/acme/MyPackage/17.10.1-SNAPSHOT/MyPackage-17.10.1-20170908.092803-1.war"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-release-candidates/com/acme/MyPackage/17.10.1-24/MyPackage-17.10.1-24.pom"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-release-candidates/com/acme/MyPackage/17.10.1-24/MyPackage-17.10.1-24.war"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-devel/com/acme/MyPackage/17.9.3-SNAPSHOT/MyPackage-17.9.3-20170907.105908-1.pom"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-devel/com/acme/MyPackage/17.9.3-SNAPSHOT/MyPackage-17.9.3-20170907.105908-1.war"
} ]
}
I would expect that the results would be limited to the the libs-devel repo, as specified in the url.
Have I done something wrong? Is this a bug?
Here's the API reference (for version 4) that I followed:
https://www.jfrog.com/confluence/display/RTF4X/Artifactory+REST+API#ArtifactoryRESTAPI-ArtifactSearch(QuickSearch)
Thanks in advance.
Yes. This is correct.
You will be able to limit the search query to specific repositories by adding the 'repos' parameter on this rest call.
We (JFrog) are not familiar with a bug on this subject and it is working on our side (Artifactory OSS - same version: 4.8.0).
We will be interested to know if the same is working for you using the UI quick search.
If using curl, the full URL needs to be encapsulated in quotes. Otherwise the & is left off the request.
I tried using Postman and it works as expected.
Bested by quote marks. :-(

Google Analytics V4 API - Right Syntax for dynamicSegment and metricFilter

Trying (using Python) to create dynamic segment to get all sessions who completed a specific goal.
Current syntax I'm using for the metricFIlter:
"metricFilter":
{
"metricName":"ga:goal3Completions",
"operator":"NUMERIC_GREATER_THAN",
"comparisonValue":[0]
}
I've also tried other options like ['0'], 0, '0' but with no success.
Here is the response error I'm getting:
"Invalid value at 'report_requests[0].segments[0].dynamic_segment.session_segment.segment_filters[0].simple_segment.or_filters_for_segment.segment_filter_clauses[0].metric_filter.operator' (TYPE_ENUM), "NUMERIC_GREATER_THAN""
Any suggestions how to fix it ?
The operator NUMERIC_GREATER_THAN is only valid for filtering dimensions, not metrics.
"metricFilterClauses" : [
{
"filters" : [
{
"metricName" : "ga:goal3Completions",
"operator":"GREATER_THAN",
"comparisonValue": "0"
}
]
}
]
You can find a list of operators in the API docs.

Artifactory API AQL "Displaying Specific Fields"

According to below link, Artifactory AQL allows "Displaying of specific fields" via REST API by returning only fields of interest.
https://www.jfrog.com/confluence/display/RTF/Artifactory+Query+Language#ArtifactoryQueryLanguage-DisplayingSpecificFields
It doesn't work if I provide a list of fields, see below
Not Work - Bad request (400)
items.find(...).include("name", "repo")
Works
items.find(...).include("*")
Can anyone advise
Thanks, Jag
I suspect that the problem is related to encoding during the REST call, therefore I suggest to upload the query as a file Here is a working example:
Save the following query to file, lets call it aql.query
items.find
(
{
"repo": {"$match":"*"}
}
)
.include("name","repo")
Run the following curl command from the same directory that contains the aql.query file and don't forget to replace the templates in the command with your user name, password, host and port.
curl -X POST -uuser:password 'http://host:port/artifactory/api/search/aql' -Taql.query
In the result you will get:
{
"results" :
[
{
"repo" : "ext-snapshot-local",
"name" : "maven-metadata.xml"
},{
"repo" : "ext-snapshot-local",
"name" : "multi-3.0.0-20150705.195404-1.pom"
},{
.
.
.
}
],
"range" :
{
"start_pos" : 0,
"end_pos" : 46,
"total" : 46
}
}
As you can see that the result contains only the "item repo" and the "item name" fields.
Had the same issue. Spent quite a bit of time trying to figure this out. Couldn't find an answer online.
With a bad request(400), I printed the response text: "For permissions reasons AQL demands the following fields: repo, path and name."
This solution worked for me -
at a minimum: have repo, path, name.
ie... items.find(...).include("name", "repo", "path", "created_by")

Resources