Add headers to the single calls in the payload - odata

I want to add custom headers in the payload of a batch. I have already achived to add it on single calls but I can't figure out how to add on eacht single call inside the payload in a Batch.
I have followed the steps here
https://blogs.sap.com/2016/07/13/set-and-get-custom-http-header/
I would like to receive it here too. Is that possible?Alternatively I could also just read the header of the Batch I can't find out how.

If you add the headers in the manifest, or using setHeaders method of the model, the header is added to batch itself and also to the single requests inside the batch. At least this is the case for v2.ODataModel implementation. not absolutely sure for ui5s implementation of the v4.ODataModel, but would assume the same. Example definition in manifest.json:
"": {
"dataSource": "mainService",
"preload": true,
"settings": {
"defaultCountMode": "Inline",
"useBatch": true,
"headers": {
"foo": "bar"
}
}
}
had to use headers in a v4 Model yesterday. So quick update: it works the same with the only difference that the property is called httpHeaders rather than headers

Related

Is it possible to pass AWS EventBridge rule event variables to the target Invocation HTTP Parameters?

I am pretty sure I miss something simple but I don't seem to fins any resource on my issue and I am a novice on AWS.
The problem is as follows: I have a scenario where I would like to trigger a REST POST API when files are uploaded to an S3 bucket. This POST API uses OAuth 2.0 and requires the file name in the body.
I created a rule that successfully triggers on upload and the API works well if I put a static filename as Invocation Http Parameter. But I would like this value to be dynamic, based on the file that triggers the event.
I have tried using the jQuery snippet $.detail.object.key but, as much as it works for adding a Query Parameter from the rule, it doesn't seem to work if used in the Invocation Http Parameters settings in the API connection.
The event pattern is as follows:
{
"source": ["aws.s3"],
"detail-type": ["Object Created"],
"detail": {
"bucket": {
"name": ["jna-test-bucket"]
},
"object": {
"key": [{
"prefix": "testFileForAPI"
}]
}
}
}

Code generated by openapi-generator always sends empty arrays when uniqueItems = true in openapi documentation

I made a REST endpoint and an open-api documentation for it using SpringDoc+Swagger. Request body of endpoint has a field - set of objects. As I see in generated documentation, it's the same thing as array, except the uniqueItems field:
"fooSet": {
"uniqueItems": true,
"type": "array",
"items": {
"$ref": "#/components/schemas/Foo"
}
}
Frontend dev uses openapitools/openapi-generator-cli to interact with my endpoint using open-api docs. This lib enforces him to use JS Set in this case. But it cannot serialize Set properly! The openapi-generator-cli generated this code for serialization:
JSON.stringify returns empty array for any Set: JSON stringify a Set
How can frontend dev customize set serialization? Without editing generated code manually, of course
How can I disable uniqueItems for all Sets without having to replace all of them to Lists, or add annotation on each Set in each DTO?
As Helen commented, the problem could be solved by mapping Set to Array via type mappings in gradle task: github.com/OpenAPITools/openapi-generator/issues/11746
The other solution I found is to remove uniqueItems flag manually in OpenApiCustomiser:
override fun customise(openApi: OpenAPI) {
openApi.components.schemas.forEach { customSchema ->
customSchema.value.properties.values
.forEach {
if (it.uniqueItems == true) {
it.uniqueItems = null
}
}
}
}

In Power Automate, is there a way to filter on a Custom Field using DevOp's Send HTTP Request?

I'm trying to use Power Automate to return a custom work item in Azure DevOps using the "workitemsearch" API (via the "Send HTTP Request" action). Part of this will require me to filter based on the value of a Custom Field, however, I have not been able to get it to work. Here is a copy of my HTTP Request Body:
{
"searchText": "ValueToSearch",
"$skip": 0,
"$top": 1,
"filters": {
"System.TeamProject": ["MyProject"],
"System.AreaPath": ["MyAreaPath"],
"System.WorkItemType": ["MyCustomWorkItem"],
"Custom.RequestNumber": ["ValueToSearch"]
},
"$orderBy": [
{
"field": "system.id",
"sortOrder": "ASC"
}
],
"includeFacets": true
}
I have been able to get it to work by removing the Custom.RequestNumber": ["ValueToSearch"] but am hesitant to use that in case my ValueToSearch is found in other places like the comments of other work items.
Any help on this would be appreciated.
Cheers!
From WorkItemSearchResponse, we can see the facets (A dictionary storing an array of Filter object against each facet) only supports the following fields:
"System.TeamProject"
"System.WorkItemType"
"System.State":
"System.AssignedTo"
If you want to filter RequestNumber, you can just set it in the searchText as the following syntax:
"searchText": "RequestNumber:ValueToSearch"

Google Docs API : How to update alignment of the table?

I have a Table in the google docs and want to change its alignment to -0.71 but i do not see any Python API to change table properties. This can be done easily using following UI on google UI (as shown below):
I also tries looking at following requests but could not find it:
updateTableColumnProperties
updateTableCellStyle
For debugging, i created a doc with mentioned alignment and tried dumping JSON of it. But i do not see alignment keyword in the JSON.
Thanks #jescanellas for reply.
I found a hack, this may not be the best solution but works.
1) Update paragraph style and set the indentation, alignment as required. Here the start_idx is the index where table needs to be created.
request = [{
'updateParagraphStyle': {
'paragraphStyle': {
'namedStyleType': 'HEADING_5',
'direction': 'LEFT_TO_RIGHT',
'alignment': 'START',
'indentFirstLine': {
'magnitude': -51.839999999999996,
'unit': 'PT'
},
'indentStart': {
'magnitude': -51.839999999999996,
'unit': 'PT'
},
},
'fields': '*',
'range': {
'startIndex': start_idx,
'endIndex': end_idx
}
}
}]
2) Create the table, it will get created at new indented place.
request = [{
'insertTable': {
'rows': 1,
'columns': 1,
'location': {
'segmentId':'',
'index': start_idx
}
},
}]
It's not currently possible to do so. You can create a Feature Request for the Docs API, and you can also subscribe to this one for Apps Script by clicking on the star next to the Issue number to give more priority to the request and to receive updates.
In case of the second request being implemented, you could call the script from the command line using Clasp.

Elasticsearch: aggregation of URLS

I want my elasticsearch / Kibana4 to give me an overview which pages of my website are viewed most. I have a field "request" but since the URLs listed there contain parameters, I get a false list of the top requests
Example:
/search?query=123
/search?query=234
Each request is shown as a single request
but
home/foobar
home/foobar
is listed with 2 requests and is the top request in this case.
How can I tell elasticsearch to aggregate the requests that contain parameters?
There are number of ways to solve this.
One would be setting the url field as not_analyzed and then using script to parse out the unwanted value.
A sample script can be found here -
{
"aggs": {
"urls": {
"terms": {
"field": "url",
"script" : "_value.split("?")[0]"
}
}
}
}
Another approach would be to add a multifield and then remove the part after '?' using custom analyzer . You can achieve this by removing anything after '?' using pattern replace tokenizer

Resources