Using POST/variable/import API Endpoint to import environment variables into Matillion Environment using Airflow DAG

I am trying to add environment variables into Matillion via the Matillion API using the SimpleHTTPOperator in Airflow.

 

I am using this base url (dox: https://documentation.matillion.com/docs/2768621): http://<InstanceAddress>/rest/v1/group/name/<groupname>/project/name/<projectName>/environment/name/<environmentName>/variable/import

 

Here is my code

 

There is nothing wrong with my http_conn_id since I am able to update env vars via the POST /set/instance API endpoint. However, I would like to import variables as opposed to just update them.

 

The error I am getting is:

"ERROR - {“success”:false,“msg”:“Unrecognized token ‘objects’: was expecting (‘true’, ‘false’ or ‘null’)\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream)

 

I am not sure what ‘objects’ or ‘version’ in the post body is referring to.

 

Any help would be much appreciated. Thank you.

Just answered my own question!

 

For anyone interested, I just had to add 'json.dumps(env_vars)' in the 'data' parameter of the DAG.

 

Hi @p.lahoz12

I am glad you were able to answer your own question. Thanks for informing the Community as well.

Chika