API design – call of Microserice with REST or a dedicated client jar

When microservices need to talk to each other, it is common to have REST (or gRPC) communication.

I wonder What should be a better approach? (Let's say all services are in Java) –

  1. Each service uses a freestyle REST client (e.g. OkHttp)
  2. If Service A needs to communicate with Service X, it must contain a "Service X Client" dependency JAR library that hides the network communication from Service A.

Suppose this is our system in which service A uses services X and Y as data resources:

   /-X
A--
   -Y

Here are some cases:

New functionality in X.

In both approaches, when Service X has new features for A, A's code needs to be updated to support it and add new HTTP calls. If we use a dependency JAR, we also need to create a new version of the JAR.

New versions of X / Y.

Versions are updated in X and Y as long as they do not damage the interface. In both approaches, no change in A is required.

Different HTTP library versions in X&Y clients

It is possible that X&Y client libraries contain different versions of the same HTTP client. This can lead to a dependency library connection in Service A.

What is the best course of action today? I found this post and this post where everyone supports the different approach. I also came across Feign as a REST client, which could be a third option

Meta query – How do you get contributions from multiple meta keys and meta values ​​with the rest API V2?

I try to get my posts through several meta_keys and meta_values. How do I do it? The URL should look like this: "/ posts? Meta_key = example & meta_value = example2 & meta_key = example3 & meta_value = example4"
I've been trying to find a solution for quite a while, but couldn't find most of the things that were out of date.
I hope someone can help me.

sharepoint online – How does the OverrideViewXml parameter work with ViewXml in RenderListDataAsStream in the rest API?

I'm working on getting data from the SharePoint list using the RenderListDataAsStream endpoint.
I first get all the views defined for the list and display them in a drop-down menu on the user interface. The user then selects the view

  • I get the ListViewXML for this view
  • Create a custom filter query like ...

and then pass this ListViewXML as ViewXML and custom filter as OverrideViewXml in body parameters for the remainder call of RenderListDataAsStream.

From here it says that OverrideViewXml is for

Specifies the overriding XML to be combined with the View CAML. Only applies to the query / where part of the view CAML.

I want to know exactly how OverrideViewXml works in conjunction with ViewXml. If I specify ViewXML, the OverrideViewXml query is ignored or does not work. If I only specify OverrideViewXml and not ViewXml, the OverrideViewXml query works. At the moment there are no results (whether "ANDing" or "ORing") from OverrideViewXml with ViewXML.

For remaining calls I use the PNP JS library (2.0.3) and the solution is in SPFX

Views – How to call rest api in Drupal8 after submitting the form

I have created an internal API call as '/api/v1/user/promotional-emails' This API calls some external APIs and we update the data there. In Postman API works well.

Now I have created a user form as '/user/promotional-emails' This form appears fine, but I need to call the API call I created earlier '/api/v1/user/promotional-emails'. but there is always NULL as the answer.

I tried the following method but it doesn't work. I don't know what to do.

/**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    global $base_url;

    $result1 = $form_state->getValue('option1');
    $result2 = $form_state->getValue('option2');
    $result3 = $form_state->getValue('option3');
    $result4 = $form_state->getValue('option4');

    $json = (
        'headers' => (
          'Content-Type' => 'application/json',
        ),
          'form_params' => (
                  'EmailAddress' => 'test@gmail.com',
                  'EmailOptin' => true,
                  'option1' => $result1,
                  'option2' => $result2,
                  'option3' => $result3,
                  'option4' => $result4
              )
            );
    $options = ('option1' => $result1,'option2' => $result2,'option3' => $result3,'option4' => $result4, 'EmailAddress' => 'test@gmail.com');

Option 1 I tried:

 $url = $base_url . '/api/v1/user/promotional-emails';

     $client = new Client(('verify' => false));

     $rest_response = $client->request('POST', $url, $json);

This also gives NULL

Option 2 I tried

$client = Drupal::service('http_client_factory')->fromOptions(array('verify' => FALSE));
    $request = $client->post($base_url.'/api/v1/user/promotional-emails', $options);
    $response = json_decode($request->getBody());

I also get zero here. Can any body help me with this?

My API caller is like this.

public function unsubscribeEmail(Request $request) {
    // Get post body data in json.
    $requestContent = json_decode($request->getContent(), TRUE);
    // Get token.
    print_r($request); exit;
}

sharepoint online – role assignment: Get MemberId and RoleDefinitionBindings in one REST API call

I want to get all role assignments for a site with MemberId and RoleDefinitionBindings. I list role assignments for a site with a call _api/web/roleassignmentsThen I make two additional calls for each role assignment: to get MemberId and RoleDefinitionBindings.

Unfortunately, this is too slow. Is there a way to do this in fewer REST API calls?

Plotting – How do I draw the rest of a function if I don't know roots explicitly?

I want to draw remnants of a function, but we know roots explicitly. I can draw them like in the first example, but if I don't know roots analytically, the result is wrong. I only repeat the first example in the second example, but replace the explicit root with

LL(e_, p_, t_, zx_, zy_) := Root(Function(w, G(e, p, t, zx, zy, w_)), 1);

and I don't know how to fix it.

a0(e_,p_,t_,zx_,zy_) := (e + p)/(t*(1-zx^2-zy^2)^(1/2));
a11(e_, p_, t_, zx_, zy_) := ((I*(e + p))*(zy^2 - zx^2 - 2))/((2 + zx^2 + zy^2)*(1 - zx^2 - zy^2));
b1(e_, p_, t_, zx_, zy_) := -((2*I*(e + p))*zx*zy)/((2 + zx^2 + zy^2)*(1 - zx^2 - zy^2));
c0(e_, p_, t_, zx_, zy_) := (e + p)/(t*(1 - zx^2 - zy^2)^(1/2));
c1(e_, p_, t_, zx_,zy_) := ((I*(e + p))*(zx^2 - zy^2 - 2))/((2 + zx^2 + zy^2)*(1 - zx^2 - zy^2));
f0(e_, p_, t_, zx_, zy_) := a0(e, p, t, zx, zy)*c0(e, p, t, zx, zy);
f1(e_, p_, t_, zx_, zy_) := a0(e, p, t, zx, zy)*c1(e, p, t, zx, zy) + a11(e, p, t, zx, zy)*c0(e, p, t,zx,zy);
f2(e_, p_, t_, zx_, zy_) := a11(e, p, t, zx, zy)*c1(e, p, t, zx, zy) - b1(e, p, t, zx, zy)*b1(e, p, t,zx,zy);
A(zx_, zy_) := 2 + zy^2 - zx^2;
M(zx_, zy_) := 3*zx*zy;
G(e_, p_, t_, zx_, zy_, w_) := f0(e, p, t, zx, zy) + f1(e, p, t, zx, zy)*w + f2(e, p, t, zx, zy)*w^2;
H(e_, p_, t_, zx_, zy_, w_) := (2 + zx^2 + zy^2)*(1 - zx^2 - zy^2)^(1/2)*G(e, p, t, zx, zy, w);
SIGMAXX(e_, p_, t_, zx_, zy_, w_, n_, v_) := (n^2* v^2*(a0(e, p, t, zx, zy)*A(zx, zy) + (a11(e, p, t, zx, zy)*A(zx, zy) - M(zx, zy)*b1(e, p, t, zx, zy))*w))/(H(e, p, t, zx, zy, w));
Plot(Evaluate(Im(Residue(SIGMAXX(0.5, 0.5, 1, 0.1, zy, w, 1,10), {w, (-I*(1 - (0.1)^2 - zy^2)^(1/2)*((2 + (0.1)^2 + zy^2)/(2-(0.1)^2 -zy^2)))/(1)}))),{zy, 0, 0.5})

and the action is
Enter the image description here

but if I define the first root of G like this:

LL(e_, p_, t_, zx_, zy_) := Root(Function(w, G(e, p, t, zx, zy, w_)), 1);

it doesn't work, I don't want to check it directly because in more complicated cases I don't know the roots explicitly.

a0(e_, p_, t_, zx_, zy_) := (e + p)/(t*(1 - zx^2 - zy^2)^(1/2));
a11(e_, p_, t_, zx_, zy_) := ((I*(e + p))*(zy^2 - zx^2 - 2))/((2 + zx^2 + zy^2)*(1 - zx^2 - zy^2));
b1(e_, p_, t_, zx_, zy_) := -((2*I*(e + p))*zx*zy)/((2 + zx^2 + zy^2)*(1 - zx^2 - zy^2));
c0(e_, p_, t_, zx_, zy_) := (e + p)/(t*(1 - zx^2 - zy^2)^(1/2));
c1(e_, p_, t_, zx_,zy_) := ((I*(e + p))*(zx^2 - zy^2 - 2))/((2 + zx^2 + zy^2)*(1 - zx^2 - zy^2));
f0(e_, p_, t_, zx_, zy_) := a0(e, p, t, zx, zy)*c0(e, p, t, zx, zy);
f1(e_, p_, t_, zx_, zy_) := a0(e, p, t, zx, zy)*c1(e, p, t, zx, zy) + a11(e, p, t, zx, zy)*c0(e, p, t,zx,zy);
f2(e_, p_, t_, zx_, zy_) := a11(e, p, t, zx, zy)*c1(e, p, t, zx, zy) - b1(e, p, t, zx, zy)*b1(e, p, t,zx,zy);
A(zx_, zy_) := 2 + zy^2 - zx^2;
M(zx_, zy_) := 3*zx*zy;
G(e_, p_, t_, zx_, zy_, w_) := f0(e, p, t, zx, zy) + f1(e, p, t, zx, zy)*w + f2(e, p, t, zx, zy)*w^2;
H(e_, p_, t_, zx_, zy_, w_) := (2 + zx^2 + zy^2)*(1 - zx^2 - zy^2)^(1/2)*G(e, p, t, zx, zy, w);
SIGMAXX(e_, p_, t_, zx_, zy_, w_, n_, v_) := (n^2* v^2*(a0(e, p, t, zx, zy)*A(zx, zy) + (a11(e, p, t, zx, zy)*A(zx, zy) - M(zx, zy)*b1(e, p, t, zx, zy))*w))/(H(e, p, t, zx, zy, w));
LL(e_, p_, t_, zx_, zy_) := Root(Function(w, G(e, p, t, zx, zy, w_)), 1);
Plot(Evaluate(Im(Residue(SIGMAXX(0.5, 0.5, 1, 0.1, zy, w, 1,10), {w,LL(0.5, 0.5, 1, 0.1, zy_) }))),{zy, 0, 0.5})

Enter the image description here

Web application – Spring Data Rest 2.4 does not work with {? page, size, sort} links

I'm trying to run my Spring Boot v2.1.5.RELEASE app web template, but when I go to http: // localhost: 8080 / I see the following:

_links  
users   
href    "http://localhost:8080/users{?page,size,sort}"
template    true
profile 
href    "http://localhost:8080/profile"

The template is not executed

rest – Update person field (multiple selection) with JavaScript without PnP

I am trying to create an SPFx web part using SharePoint 2016. When I add PnP to SharePoint 2016, errors appear and it doesn't work as if I were adding it to a Sharepoint online SPFC web part. How can I update a list item field to add the current user (or remove the current user from this field)?

I cannot find the API to meet this requirement.