HoneyBear.HalClient icon indicating copy to clipboard operation
HoneyBear.HalClient copied to clipboard

Retrieve single objects

Open hacki11 opened this issue 4 years ago • 2 comments

Hi, i found your library and the api looks very nice for consuming hal based rest apis.

I have two questions regarding the api usage:

  1. Retrieve a single resource My Resource:
{
  "_embedded" : {
    "users" : [ {
      "id" : 2,
      "name" : "asddf",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/users/2"
        },
        "user" : {
          "href" : "http://localhost:8080/users/2"
        },
        "address" : {
          "href" : "http://localhost:8080/users/2/address"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/users{?page,size,sort}",
      "templated" : true
    },
    "profile" : {
      "href" : "http://localhost:8080/profile/users"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 1,
    "totalPages" : 1,
    "number" : 0
  }
}

How do i get the user resource with id 2 without fetching everything and traverse through the result? I am looking for a single http request solution to get /users/2 into my user dto.

  1. How is error handling solved? How do i check for all the http error codes and messages e.g.: /users/3 => 404 or with detailed json result.

hacki11 avatar Aug 17 '19 18:08 hacki11