Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Delete all jobs of a version by using v1 API

Hello,

I need to delete all jobs of the default version of a project by using the v1 API.

I could not find any appropiate endpoint to do so by exploring the URLs.

Isn't it supported at all or did I miss the correct endpoint?

Best regards,
Gökhan

4 Community Answers

Matillion Agent  

David Lipowitz —

Hi Gökhan,

Thanks for the question. You can delete a version using the API, which will remove all of its jobs at the same time. But unfortunately you cannot delete the “default” version as that has special significance to the Matillion application.

Here are a few workarounds:

  1. You can create and use a different version from the “Project” pull-down. Then you can delete that version (and all the jobs it contains) using a command similar to this: curl -X POST -u username:password “http://{your-ip-address}/rest/v1/group/name/{your-group-name}/project/name/{your-project-name}/version/name/{your-version-name}/delete”
  2. You can put all the jobs in the default version underneath a single folder. Then you can right-click on that folder and delete it manually, which will remove all of its jobs.

I hope that helps and please let us know if you have any additional questions.

Best Regards,
Dave


Goekhan Cimsir —

Hey David,

Thank you for your response.

My goal is to automate the process of importing/exporting the ETL model from a project and version to another project and version. Thus I would like to only use the API for all Matillion operations. Deleting and creating a version sounds good as a workaround but I could not find the proper API endpoint to create a version.

Is that supported?

Best regrads,
Gökhan


Matillion Agent  

David Lipowitz —

Hi Gökhan,

Yes, the pattern you describe is supported. We suggest starting with a version other than “default” because the default version cannot be deleted.

Also, please note that the import itself into the target project creates a version with the same name as the version exported from the source project. As such, no name is required (or accepted) in the import URL.

The curl commands below demonstrate how to export a version from the source project, delete the version of the same name from the target project, and finally import the exported version into the target project:

  1. curl -X GET -u username:password “http://YourIPAddress/rest/v1/group/name/YourGroup/project/name/SourceProject/version/name/SourceVersion/export” -o export.json
  2. curl -X POST -u username:password “http://YourIPAddress/rest/v1/group/name/YourGroup/project/name/TargetProject/version/name/SourceVersion/delete”
  3. curl -X POST -u username:password “http://YourIPAddress/rest/v1/group/name/YourGroup/project/name/TargetProject/version/import” -o export.json

I hope that’s helpful and please let us know if any questions remain.

Best Regards,
Dave


Matillion Agent  

David Lipowitz —

Hi Gökhan,

Apologies but I pasted the wrong curl command in the import curl command. It should read as follows:

curl -X POST -u username:password “http://YourIPAddress/rest/v1/group/name/YourGroup/project/name/TargetProject/version/import” -H “Content-Type: application/json” —data-binary @export.json

Best Regards,
Dave

Post Your Community Answer

To add an answer please login