Search code examples
apigooddata

How to access key-value Lookup through the API in GoodData?


In GoodData's ETL tool there's a key-value store that one can use for keeping some kind of state between ETL runs: http://developer.gooddata.com/cloudconnect/manual/lookup-table-functions-ctl2.html

Is there a way how to set / read these values through the REST API?


Solution

  • There is something called project metadata. It holds metadata on a per project level. It is what you can see if you go to Project explorer in CloudConnect and look at customer properties.

    The data can be read like this

    GET /gdc/projects/<projectName>/dataload/metadata
    

    You can read only particular key

    GET /gdc/projects/<projectName>/dataload/metadata/<key>
    

    And update an existing key

    PUT /gdc/projects/<projectName>/dataload/metadata/<key>
    

    Also delete

    DELETE /gdc/projects/<projectName>/dataload/metadata/<key>
    

    Or create a new on

    POST /gdc/projects/<projectName>/dataload/metadata/ {"metadataItem" : {"key" : "some_key", "val" : "some_val"}}
    

    Another way is to use GoodData ruby SDK (https://github.com/gooddata/gooddata-ruby/)

    client = GoodData.connect('username', 'pass')
    project = client.projects('project_id')
    project.metadata
    
    metadata.inspect
    

    You can also set the metadata liek this

    project.set_metadata('key', 'val')