java – Consuming Multiple resources from a single REST Service

I am developing a Spring Boot Application which consumes another REST service to get the User’s Account information. The same service provides multiple operations like:

GET: /userid/retrive -to get user and account information

POST: /user/create – to create a new user

POST: /userid/save – to save the user information

DELETE: /userid – to remove the user information from the system

POST: /userid/account : to update account information

So All the above apis are exposed by one service. Some of them return the same response object while others do not and each of them have their own request parameters and request headers that should be set before calling.

So what I have done is I have created a Base class which will have the common code and I have extended it for One Rest template per API operation which will set its own request parameters and call the service and also has different exception loggers/messages.

The service also exposes other operations which we start consuming in our upcoming sprints, and I wanted to make sure if we can utilize any existing design pattern for our advantage.

So I am writing this question to know if there are any alternatives or any design patterns you could suggest so as calling the same service would not have multiple rest templates.

javascript – Consumir api rest mostrando elementos aleatórios

javascript – Consumir api rest mostrando elementos aleatórios – Stack Overflow em Português

Post comment to a modern site page using REST api

Posting to the below endpoint for comments on a site page throws an error.
Endpoint:

/_api/web/Lists('<sitepagesguid>')/GetItemById(305)/Comments

Response:

The expression "web/Lists('cd1dae9b-e3a7-45fc-a610-8069e3dd081d')/GetItemById(305)/Comments" is not valid.

Site page comments are not stored in a list and don’t follow the same schema so how do I post comments via REST endpoints?

How to get content of file in sharepoint using sharepoint rest api

We need to use the below API:

GET https://mysite.sharepoint.com/<site_name>/_api/web/lists(guid'<list-id>')/items(<item-id>)/File

api of sharepoint using list id and item id obtained from /getchanges api. Then use the ServerRelativeUrl field of response to obtain file contents by calling :-

GET http://mysite.sharepoint.com/<site_name>/_api/web/getfilebyserverrelativeurl('<url>)/$value?binaryStringResponseBody=true

Reference URL:

How to point to/get the file contents or file from SharePoint changes api call

how to get file content from sharepoint list using restapi in java

Similar question discussed here:

https://stackoverflow.com/questions/48422868/how-to-get-file-content-from-sharepoint-list-using-restapi-in-java

java – Getting Comparison method violates its general contract exception while doing Rest call

I am working on a Spring boot application. Recently I have updated the dependency in pom.xml as follows:

 <dependency>
     <groupId>net.minidev</groupId>
     <artifactId>json-smart</artifactId>
     <version>2.4.7</version>
 </dependency>

Post this, I am getting Comparison method violates its general contract! exception while doing a rest call as follows:

return restTemplate
        .postForEntity(uri, email, String.class).getBody();

Associated API end point is as follows:

  @GetMapping("/student/{email}")
  public ResponseEntity<Student> getStudent(@PathVariable String email) {
    Optional<Student> student = studentService.findOne(email);
    return ResponseWrapper.wrap(student);
  }
  

I don’t understand, how to fix this issue. Could anyone please help here? Thanks.

Get Group Details from Person or Group field using REST API?

Try using this:

_api/web/lists/getbytitle('listname')/items(100)?$select=Initiator/EMail,RAReviewers/EMail&$expand=Initiator,RAReviewers

Above is working fine for me in case of person or group.

Example:

/_api/web/lists/getbytitle('TestList')/items(1)?$select=TestPersonField/Title,TestPersonField/EMail&$expand=TestPersonField

Output: Below is part of response returned from above API call

<entry>
    <content type="application/xml">
        <m:properties>
            <d:Title>Ganesh Sanap</d:Title>
            <d:EMail>gsanap@tenant.onmicrosoft.com</d:EMail>
        </m:properties>
    </content>
</entry>
<entry>
    <content type="application/xml">
        <m:properties>
            <d:Title>SPConnect Members</d:Title>
            <d:EMail>SPConnect@tenant.onmicrosoft.com</d:EMail>
        </m:properties>
    </content>
</entry>

Where SPConnect Members is a Microsoft 365 group name.

Note: This will not work for SharePoint groups as they don’t have Email property.

sharepoint online – Docusign REST API: Implementing OAuth Authentication using JWT Grant from Microsoft Flow

I am getting below error when making HTTP call for JWT Token,

The Authorization Call successeeded well as whown in below screenshot , but when making HTTP Call for JWT Acess Token (screenshot 2), then below error({“error”:”invalid_grant“,”error_description”:”unsupported_grant_type“}) as shown in screenshot 4 below.

I am new to using/developing Docusign for first time,so anyone kindly correct what iam doing wrong (like if i need to put/correct URL,Headers,Body,….. ) or plese guide me about what can be the error Cause.
Kindly Guide me, Thanks in Advance
Iam following below URL from Docusign OAuth Implementation
https://developers.docusign.com/platform/auth/jwt/jwt-get-token/

Step 1. Request application consent
Step 2. Create a JWT
Step 3. Obtain the access token –>getting Error @ implementing this step
Step 4. Get your user’s base URI
Step 5. Use the access token to make an API call

(https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id=@{variables('IntegratorKey')}&redirect_uri=https://localhost1

https://account-d.docusign.com/oauth/token

https://demo.docusign.net/restapi/v2.1/accounts/@{variables('Docusign AccountID')}/envelope

Error screenshot

Pass multiple tags slug to rest API

I can pass a single tag slug to WP REST API. But, cannot pass multiple tags slug. It gives an error.

register_rest_route( 'w1/unica/', 'posts/(?P<slug>(a-z0-9)+(?:-(a-z0-9)+)*)', array(
  'methods' => 'GET',
  'callback' => 'unica_get_posts_by_tag',
  'args' => array(
      'slug' => array (
          'required' => true
      ),
      
  )

) );

Having problems uploading PDF file via REST API using C#

I am currently writing a C# program that uses the Sharepoint REST API to manage uploading and downloading of files.

Currently can retrieve files stored in folders in a subsite without problems, but I am having issues with uploading files to the same folders.

I use “/_api/web/getfolderbyserverrelativeurl(‘/Folder1/Folder2/File)$value” to retrieve a file. This works fine.

I can also get the folder itself via “_api/web/getfolderbyserverrelativeurl(‘/Folder1/Folder2′)
I am thinking I can use the same URI structure to add a file to that folder by adding “/files/add(url=’filename’, overwrite=true)” to the end of the above URI.
Set the method to “POST”, Accept to “application/json; odata=verbose”, ConentLength to length of file being sent. Also added Authorization and X-RequestDigest headers to the webrequest.

When the webrequest is sent to the server I get the following errors back (after about 30secs).

  • HttpRequestException: An error occurred while sending the request
  • IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host
  • SocketException: An existing connection was forcibly closed by the remote host

My question is… Has anyone else seen these sort of errors before and am I approaching this is the correct way.

Also related to this, once I get this file uploaded how do I add metadata to it? Or does the meta data get added to the file as it is uploaded?

Any thoughts or comments are very much appreciated.

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123