Question

Creating a Look via the API

  • 29 November 2016
  • 2 replies
  • 319 views

I have been creating a HTTP POST call to create a new Look on the API (which is close to working).

This is coming from a modified copy of the Look GET from another Look (in an attempt to create a duplicate).


I have an issue where the visualization is showing in the default tabular format instead of the correct.

I assume (but it is hard to tell from the docs that it is the vis_config which is used).


I am passing in what I believe is correct JSON (snippet below):



“vis_config”: {

“stacking”: “”,

“show_value_labels”: true,

“label_density”: 25,

“legend_position”: “center”,

“x_axis_gridlines”: false,

“y_axis_gridlines”: true,

“show_view_names”: false,

“limit_displayed_rows”: false,

“y_axis_combined”: false,

“show_y_axis_labels”: false,

“show_y_axis_ticks”: false,

“y_axis_tick_density”: “default”,

“y_axis_tick_density_custom”: 5,

“show_x_axis_label”: true,

“show_x_axis_ticks”: true,

“x_axis_scale”: “auto”,

“y_axis_scale_mode”: “linear”,

“ordering”: “none”,

“show_null_labels”: false,

“show_totals_labels”: false,

“show_silhouette”: false,

“totals_color”: “#808080”,

“show_null_points”: true,

“point_style”: “circle”,

“interpolation”: “linear”,

“custom_color_enabled”: false,

“custom_color”: “forestgreen”,

“show_single_value_title”: true,

“show_comparison”: false,

“comparison_type”: “value”,

“comparison_reverse_colors”: false,

“show_comparison_label”: true,

“type”: “looker_bar”,

“series_types”: {

“test.test_portion”: “line”,

“test_facts.total”: “line”

},

“single_value_title”: “test values”

},



The response I get back shows null for the “vis_config” so I assume that is the cause of the issue but I am not sure why it isn’t working.


Is anyone able to help or have any ideas?


2 replies

Userlevel 4

Hi Ed,


Can you provide a bit more about what you are doing in your process? I expect if you just take the looks/look_id endpoint and modify the values there you may miss saving something. The vis_config actually lives within the query, so in order to do this I’d recommend this process



  • GET the look by ID (looks/look_id)

  • Pull the information for the query from the look (under query_id)

  • GET the query by ID (queries/query_id)

  • modify the query body

  • POST the query to retrieve a new query_id

  • modify the look body with that new query_id and any other changes (including title!)

  • POST the look and retrieve the new look_id


Let me know if I missed something here – I do promise some API samples to come!

Hi @eFein,


Sorry for the big delay in getting back to you.


I never realised that when copying a Look it would ignore read-only values so instead of recreating the json itself I just created a copy and updated the space and query id.


This is now working correctly.


Thanks for your help.

Reply