Skip to main content
Solved

Ansible or Curl example for importing policy variables via API

  • February 5, 2025
  • 3 replies
  • 0 views

Hello All,

I'm trying to import a list of variables in to Restorepoint via the API "/policies/variables/import" with ansible but as of now I have no luck. Does anyone have an example (can be with Curl or another language) about the right syntax?

Regards,

Michael

Best answer by MGB

Hello,

Sending me back to the documentation is not very helpful since I asked for an example. In the meantime I have figured out the solution and want to share with the community.

ansible.builtin.uri: url: https://{{ inventory_hostname }}/api/v2/policies/variables/import method: POST validate_certs: false body_format: form-multipart body: file: content: "{{ lookup('file','restorepoint_vars.csv') }}" filename: "restorepoint_vars.csv" Content-Type: text/csv overwrite: "true" headers: # Content-Type: text/csv Authorization: "{{ ApiToken }}"

This works for us,

Regards,
Michael

3 replies

Hello @MGB I have reached out to the Restorepoint team to help answer this question. Thanks for posting! 


  • February 17, 2025

Hello Michael, 

The team suggests you refer to this section of the API documentation. It should help you when trying to import the policy variables. Please let us know if we can be of further assistance. 

Thank you, 

Jude

(In case the above link does not work for you, here is the full URL: https://docs.sciencelogic.com/restorepoint/api/5-6/api.html#operation/import_policy_variables)


  • Author
  • Answer
  • February 21, 2025

Hello,

Sending me back to the documentation is not very helpful since I asked for an example. In the meantime I have figured out the solution and want to share with the community.

ansible.builtin.uri: url: https://{{ inventory_hostname }}/api/v2/policies/variables/import method: POST validate_certs: false body_format: form-multipart body: file: content: "{{ lookup('file','restorepoint_vars.csv') }}" filename: "restorepoint_vars.csv" Content-Type: text/csv overwrite: "true" headers: # Content-Type: text/csv Authorization: "{{ ApiToken }}"

This works for us,

Regards,
Michael