java – Como aplicar DAO (Hibernate) y un servicio rest

Estoy intentando hacer un servicio Rest con Java en SpringBoot que se conecte con una base de datos relacional.
Al momento de devolver un objeto tipo DAO(Hibernate) me devuelve toda la informacion, pero quiero ocultar algunos datos por ejemplo el id del objeto y queria saber que soluciones tengo ?
Crear una Clase que voy a devolver el Rest ?
Setear esos atributos como null así no expongo datos sensibles ?
Alguna otra solución será bien recibida.

javascript – Update textField to first letter capital and rest lower case

Is there an option via JavaScript to say: if the FirstName textfield is not null then update the text so that it is 1st letter being capital and the remaining lower case?

For example somebody types in the FistName textfield: jOHN (accidently).
This is how then the data is stored in SharePoint list, and I would like so that a java script updates the written text into the correct format before it is stored wrongly in the SP list.

I am trying something like this:

    NWF$(document).ready(function () {
    NWF$("#" + txtFirstName).change(function () {
        // get the text value from the FirstNname textfield
        var textContent = NWF$('#' + txtFirstName).text();

        // check to see if the value is not null
        if (textContent.length > 0) {

            // format the first letter to UpperCase and the rest to LowerCase
            textContent = NWF$("#" + txtFirstName).toUpperCase() + txtFirstName.substr(1).toLowerCase();
            this.value = txtFirstName;

project online rest api date fields

That’s probably the raw milliseconds.

Dates are actually stored as numbers that represent ticks of a certain size from a certain starting point.

From the MDN documentation on JavaScript dates:

A JavaScript date is fundamentally specified as the number of
milliseconds that have elapsed since midnight on January 1, 1970, UTC.

And it then goes on to point out the difference between JavaScript dates and UNIX time stamps, and that in UNIX the tick is a full second (not millisecond):

This date and time are not the same as the UNIX epoch (the number of
seconds that have elapsed since midnight on January 1, 1970, UTC),
which is the predominant base value for computer-recorded date and
time values.

And, in the C# DateTime struct, the ticks are 100 nanoseconds, and are counted since 12:00 midnight on Jan 1, 0001 AD.

So there are some differences. Why would I assume the ones coming from the Project Online REST API are in milliseconds?

Well, for one, Date(<something>) looks a heck of a lot like the JavaScript Date constructor. And, in addition to using an ISO string ("2021-02-10T08:00:00.000Z") or a short date format string ("2/10/2021"), you can use a number representing milliseconds since Jan 1 1970 in the Date constructor.

Second, I am also assuming that you are sending a header of Accept: application/json along with your REST request, which is telling Project Online that you want your response in JavaScript Object Notation, which is a pretty big clue to Project Online that you are using JavaScript, so it might format a response it’s going to send in JSON in a JavaScript-friendly way.

And third, it’s Project Online, and a heck of a lot of modern development, especially revolving around using cloud services/APIs, is very client-side oriented, meaning, done in JavaScript. So they could be leaning heavily on that expectation as well.

That’s all speculation though. I really am just guessing that it’s milliseconds (based on those hunches).

A quick test to see if that’s right? Open up a browser console, and just try it out:

// doing this
new Date(1612944000000)

// outputs
Wed Feb 10 2021 03:00:00 GMT-0500 (Eastern Standard Time)

At least, that’s what I get in my time zone. Does that date and time make sense for what you are expecting?

As far as why there is a difference between how REST API date results are formatted for the Project Online API vs. the SharePoint API, I guess that’s a question for the Microsoft development teams…

(As a side note – I haven’t worked with Project Online. I have worked with Project Server 2016 on-prem, and results from the /ProjectData/ REST API in that version do come back as ISO strings, same as from SharePoint, at least if you are looking at things like TaskFinishDate, TaskBaselineFinishDate, etc..)

Design relation for relational database (to import from below csv table) to query using REST API

I have this table where I am trying to make relationship between exercise and muscle group to find list of exercises for a muscle group, and also to request a list of muscle groups for an exercise. However I am having trouble to find what sort of keys should I use. Was thinking nested approach but that might be an overkill. Any suggestions/thoughts?

enter image description here

I wanted to create a separate table for boolen/junction table with bool valus, YES/NO but not sure how to leverage on this.

enter image description here

rest – Syncronous or Asynchronous communications

I have to design a REST interface between two system. Let’s say system A creates a project order and each project requires multiple items to be shipped by a company (System B). Every time an item is shipped, system B sends a notification to system A with an item ID, and System B sends an acknowledgement. System A keeps track of how many items are being shipped. Once system A receive all items pertaining to the order ID, it sends a final order completion notification to system B thewith the Project Order.

Should I create it as an asynchronous REST API, where every time the order is received, a synchronous response will be send, and once all items are received, the final response will be send? Or, should I just create separate interfaces, one for item level communications, and the other one for the completion notification.

I am new to the Rest world. Please ask, if I am not clear.

sharepoint online – How to EnsureUser with AD group in REST

I am trying to add AD group to SharePoint site in REST using EnsureUser but I kept getting error message “The specified user c:0+.w|S-1-5-21-1814438218-152777602-930774774-762833 could not be found“. Can someone please tell me what the correct format is for the logonName string? AD is on prem and we are using SP Online. Below is the code:

        string digest = formDigest == "" ? GetRequestDigest() : formDigest;
        string logonNameStr = WebUtility.HtmlEncode("c:0+.w|") + "S-1-5-21-1814438218-152777602-930774774-762833"; <== This seems to be incorrect
        string ensureUserUrl = _siteUrl + "_api/web/EnsureUser"; 
        using (var handler = GetHttpClientHandler(_siteUrl))
            using (HttpClient client = GetHttpClient(handler))
                client.DefaultRequestHeaders.Add("X-RequestDigest", digest);
                var payload = new { logonName = logonNameStr };
                string jsonBody = JsonSerializer.Serialize(payload);
                using (StringContent content = new StringContent(jsonBody))
                    content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json;odata=verbose;charset=utf-8");
                    HttpResponseMessage response = client.PostAsync(ensureUserUrl, content).Result;
                    string jsonStr = await response.Content.ReadAsStringAsync();
                    if (!response.IsSuccessStatusCode) //if adding user failed
                        throw new Exception(String.Format("Failed to add AD group {0} to SharePoint site: {1}", groupName, jsonStr));


REST API: POST and PUT for nested resources

I am wondering how to deal with nested resources in a REST API. I’ve seen other questions on the subject here, but I didn’t find one that answered my question. More specifically, should POSTing/PUTting of the parent resource should POST/PUT/DELETE the nested resources?

For example, I have a REST API with Persons and their Cars. So “cars” is a nested array of a Person. Also of note, the server should assign ids to the Persons as well as it should for Cars.

Should I POST a person and their cars in one API call or should I POST the person and then POST each one of their cars?

Option 1

POST /persons
  name: "Roger",
  cars: [{
    make: "Ford",
    model: "F-150"
    make: "Chevrolet",
    model: "Silverado"

Option 2

POST /persons
  name: "Roger"
POST /persons/30954058645/cars
  make: "Ford",
  model: "F-150"
POST /persons/30954058645/cars
  make: "Chevrolet",
  model: "Silverado"

If there is a person with cars, what should be the behavior of PUTting a person? Should I include their cars in the PUT /persons call or should I only allow adding,updating,deleting cars in the POST,PUT,DELETE /persons/:id/cars call?

Is it expected from REST APIs to be able to POST/PUT/DELETE nested resources from making a PUT call on the parent resource?

How to get SharePoint users from list by Rest API

You can use REST endpoint like:


This will give you:

  • Author ID
  • Author Title (Full Name)
  • Author LastName
  • Editor ID
  • Editor Title (Full Name)
  • Editor LastName

Then using ID you got from above endpoint, you can request profile picture like:

<siteUrl>/_api/Web/Lists/getByTitle('User Information List')/items?$filter=Id eq <User ID>&$select=Picture

OR using SP.UserProfiles.PeopleManager (Check 2nd reference link):



  1. How to get users picture field displayed via _api/Web/Lists – SharePoint Online
  2. How to Retrieve User Profile Properties(eg Picture) Using REST SharePoint