Three Way to Form URI for REST Services

Objective 

In this article, I will show how we could construct URI in three ways. 

Method # 1: Creating URI from string 

I am passing string in constructor of URI class, to create new URI. 

1.gif
 
Output

2.gif 

Method #2: New URI from Component Instance 

I am here taking host and path individually and then combining them in constructor of Uri class. 

3.gif
 
Output

4.gif 

Method #3: Creating URI using Try Pattern validation 

In this , I am showing you how could we use Try Pattern method of URI class to construct an URI. 

5.gif
 
Output 
 
6.gif

Up Next
    Ebook Download
    View all
    Learn
    View all