Open APIs

 View Only
  • 1.  href attribute and real world implementation

    Posted Sep 07, 2017 10:50
    Hi.
    According to API Design Guidelines, every resource has two manadory attributes - id and href. The document offers an example - "href=http://api/report/42". It doesn't contain specific host name and port. However , in REST specifications for different resources it looks like    "href": "http://serverlocation:port/catalogManagement/category/42".
    So, should href attributes contain URL or URN? If URL, should we have corresponding real endpoint, like nginx server, to route resource requests to appropriate locations? Should we store in database URLs or URNs?


    ------------------------------
    Sergey Gusev
    Mobile TeleSystems OJSC
    ------------------------------


  • 2.  RE: href attribute and real world implementation

    Posted Sep 08, 2017 08:08
    HI Sergey,

    The spec id & href just states that id is a unique identifier for a resource and href, the location where that resource can be found.
    In theory an href can be "usps://myname@myaddress" (usps = United States Postal Service). Having said that "href=http://api/report/42"
    is a valid URL with port portion defaulting to 80 for http. It would translate to http://api:80/report/42

    Hope that makes sense

    ------------------------------
    Santhosh Sathiyaseelan
    Verizon Communications
    ------------------------------