https://github.com/vmware-samples/site-recovery-manager-rest-api-examples
Site Recovery Manager and vSphere Replication REST API was released in 8.6 and 8.7 of the product. We would like to create a codespace in VMware github to provide examples of the main use cases which our customers have difficulties with. These examples will be code snippets (or the whole request) of working REST API requests.
https://github.com/vmware-samples/site-recovery-manager-rest-api-examples
Last synced: about 1 year ago
JSON representation
Site Recovery Manager and vSphere Replication REST API was released in 8.6 and 8.7 of the product. We would like to create a codespace in VMware github to provide examples of the main use cases which our customers have difficulties with. These examples will be code snippets (or the whole request) of working REST API requests.
- Host: GitHub
- URL: https://github.com/vmware-samples/site-recovery-manager-rest-api-examples
- Owner: vmware-samples
- License: bsd-2-clause
- Created: 2023-07-21T11:34:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-04T12:19:05.000Z (about 1 year ago)
- Last Synced: 2025-03-04T13:26:49.450Z (about 1 year ago)
- Language: Java
- Size: 137 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING_DCO.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# site-recovery-manager-rest-api-examples
Examples (code snippets) of working REST API requests.
## 1. Prerequisites
REST API gateway Open API spec file in one of the formats - .json or .yaml
REST API client generator.
Online option - https://editor.swagger.io/
Maven option:
**swagger-codegen-maven-plugin**
```
io.swagger.codegen.v3
swagger-codegen-maven-plugin
3.0.32
com.github.jknack
handlebars
4.3.0
generate-sources
generate
${swagger.definitions.url}
java
${swagger.output.dir}
true
false
false
false
false
true
legacy
true
true
```
Other options are also available.
Project build tools - Maven, Gradle, etc.
## 2. Project Setup Steps
Generate REST API gateway client.
Build REST API gateway generated client.
Create your project and introduce dependency on REST API gateway client built in the previous step.
Write your code to start calling REST API gateway endpoints.
First start with login request in order to obtain REST API gateway session token. This needs Basic Authentication with user and password credentials for the local SRM/HMS site. Add the obtained session token to the header, with key "x-dr-session", of every future REST API request.
Call get all pairings request. This is a preliminary step before calling remote login request.
Call remote login request in order to authenticate to the SRM/HMS remote site. This needs Basic Authentication with user and password credentials for the remote SRM/HMS site.
Now logged in at the local and remote site, any request of your interest can be made.
With project build tool of your choice build your project.
## Contributing
The site-recovery-manager-rest-api-examples project team welcomes contributions from the community. Before you start working with site-recovery-manager-rest-api-examples, please
read our [Developer Certificate of Origin](https://cla.vmware.com/dco). All contributions to this repository must be
signed as described on that page. Your signature certifies that you wrote the patch or have the right to pass it on
as an open-source patch. For more detailed information, refer to [CONTRIBUTING_DCO.md](CONTRIBUTING_DCO.md).
## License
BSD-2