Cisco allows you to perform laboratory work or test the APIs in sandbox. It is completely free. All the necessary devices are available in the sandbox permanently or by reservation.
Here’s what Cisco writes about it:
DevNet Sandbox makes Cisco’s free spread of technology available to developers and engineers by providing packaged labs we call Sandboxes. That’s right, totally free! There are two types of sandboxes, Always-On and Reservation. Each sandbox typically highlight one Cisco product (think, CallManager, APIC, etc). Sandboxes can be used for development, testing APIs, learning how to configure a product, training, hack-a-thons, and much more!
I tried it, it’s really cool!
I have reserved a sandbox with two 9000x-series routers for testing Netconf programmability
To test Restconf, there is Always-On router with the latest IOS-XE