I am creating new dimension element in IBM Cognos via REST API. I need to change the attributes of these elements. How can this be done via the REST api?
create element
I found the answer. Attributes are stored as cubes cells. Here's an example of setting attributes for my example.
POST: https://localhost:10005/api/v1/Cubes('%7DElementAttributes_Cars')/tm1.Update
BODY:
[{
"Cells": [
{
"Tuple#odata.bind": [
"Dimensions('}ElementAttributes_Cars')/Hierarchies('}ElementAttributes_Cars')/Elements('Caption')",
"Dimensions('Cars')/Hierarchies('Cars')/Elements('000007')"
]
}
],
"Value": "Chevrolet Niva 2015"
}]
Related
Let’s suppose we have these two facets:
“manufacturer.url”: [“/url1”, “/url2”, “/url3”]
AND
“manufacturer.name”: [“manufacturer1”, “manufacturer2”, “manufacturer3”];
I’d like to create a custom refinmentList component which show all available facets for my hits based on manufacturers.
I used connectRefinementList(MyCustomComponent); and I set manufactuer.url to attribute property.
<CustomManufacturerFilterRefinementList
attribute="manufacturer.url"
currentCategory={currentCategory}
limit={10}
locale={locale}
showMore={showMore}
searchable={searchable}
showMoreLimit={showMoreLimit}
translations={translations}
/>
Now users can see available manufacturers and can filter them or click on them to go to the manufacturer page, but since I fetch the manufacturer.url, I could only able to show the URL in the list, but I’d like to show manufacture’s name in the list and having URL to generate links.
Problem: how can I create a custom refinementList component which fetches data from two facets at the same time and combine them to generate a list of links?
PS: I tried to use searchForFacetValues function inside my custom component to retrvie manufacturer’s name with below query but I couldn’t map each url with name because there is no logical relation between them:
{
"requests": [
{
"indexName": "stg_lots",
"params": {
"facetName": [
"manufacturer.name"
],
"filters": "manufacturer.url:\"froemag\" OR manufacturer.url:\"volvo\" OR manufacturer.url:\"fendt\" ",
"maxFacetHits": 100
}
}
]
}
Thanks
I am quite new new to Smartsheets and to programming.
I am using Integromat to update various stuff in Smartsheets - 99% operations are done via a nice interface for dummies.
But I have an issue with one column which is MULTI_PICKLIST and which cannot be processed with native dummy-friendly UI.
Basically, I'm adding a new row and one of the columns on the way is the MULTI_PICKLIST one. In order to enter value into this cell, I need to make an arbitrary HTTP API call.
I know row ID, I know column ID. I just need to construct the body of the HTTP request.
The possible picklist value are: John or Maya or Paul. Assume I need to enter "John" into the column.
Attached, you will find my "progress". I obviously, I'm stuck with the BODY part. Can someone give me a little push, please? I think it's gotta be like 5 lines of code.
This is what I have:
DZ
A few things...
First, the value that you're using for URL doesn't look quite right. It should be in the following format, where {sheetId} is replaced with the ID of the sheet you're updating:
sheets/{sheetId}/rows
Second, I don't think you need the key/value that you've specified for Query String -- I'd suggest that you delete this info.
Next, I'm not sure what the other possible values are for Type (based on your screenshot, it looks like a picklist) -- but if JSON is an option, I'd suggest choosing that option instead of Text.
Finally, here's any example of the correct structure/contents for Body to update a MULTI_PICKLIST cell with the value John -- replace the value of the id property (5225480965908356) with your Row ID and replace the value of the columnId property (8436269809198980) with your Column ID:
[
{
"id": "5225480965908356",
"cells": [
{
"columnId": "8436269809198980",
"objectValue": {
"objectType": "MULTI_PICKLIST",
"values": ["John"]
}
}
]
}
]
If you want to select multiple values for a MULTI_PICKLIST cell, here's an example that specifies two values for the cell (John and Maya):
[
{
"id": "5225480965908356",
"cells": [
{
"columnId": "8436269809198980",
"objectValue": {
"objectType": "MULTI_PICKLIST",
"values": ["John", "Maya"]
}
}
]
}
]
** UPDATE **
My initial answer answer above assumed you wanted to update a cell value in a MULTI-PICKLIST column (b/c you've selected PUT for the Method value in your screenshot -- which is the verb used to update a row). Having re-read your question just now though, it sounds like maybe you want to add a new row...is that correct? If so, then the value for Method should be POST (not PUT), and Body will need to include additional objects within the cells array to specify values of other cells in the new row. The following example request (when used with the verb POST) adds a new row and populates 3 cells in that row, the first of which is a MULTI_PICKLIST cell:
[
{
"cells": [
{
"columnId": "8436269809198980",
"objectValue": {
"objectType": "MULTI_PICKLIST",
"values": ["John"]
}
},
{
"columnId": 6101753539127172,
"value": "test value"
},
{
"columnId": 4055216160040836,
"value": 10
}
]
}
]
More info about the Add Rows request can be found in the Smartsheet API docs: Add Rows.
I am trying to learn Talend.
Scenario:
I have to create a REST endpoint (i am using tRESTRequest) which takes a POST request at http://localhost:8086/emp/create and accepts below json and prints each json field and sends a sample json response containing only name field.
How can I do so ?
How to read the json data into a java component like tJava?
Structure:
{
"emp" :
[
{
"id":"123",
"name": "testemp1"
},
{
"id":"456",
"name": "testemp2"
}
]
}
Expected Response:
{
"emp" :
[
{
"name": "testemp1"
},
{
"name": "testemp2"
}
]
}
I am using tRESTRequest -> tExtractJSONFields -> tRESTResponse.
For looping on the right elements and parsing the contents, please see my answer JSON Deserialization on Talend
I did not understand the second question. When deserializing JSON, the data will already be available in the usual row format for processing further. Beginner tutorials will show you the standard structure. The component tJava is - of course - an exception to that rule. Handling data is different in this component and not neccessarily row based.
Talend has an excellent knowledge base for components and examples, see https://help.talend.com/
I am trying to show an entity stored in my OrionContextBroker instance in the Wirecloud MapViewer widget. I create the context using this JSON POST REST request to miOrionInstance:1026/v1/updateContext like this:
{
"contextElements": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1",
"attributes": [
{
"name": "position",
"type": "string",
"value": "43.47258, -3.8026643"
}
]
}
],
"updateAction": "APPEND"
}
I am able to recover this information through the NGSIUpdater Widget with no problem, but I am unable to show this entity in the MapViewer widget. I have tried to wire the NGSISource Operator to the NGSIEntityToPol Operator and finally to the MapViewer Widget (in Insert/Update centered Pol).
The configuration of the NGSISource operator is:
NGSI server URL: http://miOrionInstanceIP:1026
NGSI proxy URL: http://ngsiproxy.lab.fi-ware.org
NGSI entity types: Room
Id Pattern:
Monitored NGSI Attribures: position
And the configuration of the NGSIEntityToPol Operator is the following:
Coordinates attribute: position
But nothing appears in the map.
Thanks,
The "NGSI entity types" value is incorrect, it should contain the entity type of the entities you are interested in (e.g. Room). The rest of your configuration seems correct, so if changing this setting doesn't solve your problems, you may be facing the same problems described at this question.
I have a table Article, a table Tag and a joint table to associate a tag to an article.
While creating a new Article, by sending a POST request to /Service.svc/Articles, is it possible to enclose in the JSON object a list of Tag ids to be associated?
Something like:
{
title: "My article title",
text: "The content:",
Tags: [ { id: 1 }, { id: 2 }, { id: 3 } ]
}
If not can I send the list of tags in one request? For example:
/Service.svc/Articles(1)/Tags
[ { id: 1 }, { id: 2 }, { id: 3 } ]
Or do I have to make as many requests as they are tags?
Thank you very much in advance.
You can modify just the links by POST/PUT/DELETE to the $links URL as described here: http://www.odata.org/developers/protocols/operations#CreatingLinksbetweenEntries
The samples there use ATOM/XML, but the respective JSON format is also possible.
To send multiple operations to the server in one request (to save the roundtrips) you can create a batch request as described here:
http://www.odata.org/developers/protocols/batch