REST

172

Solutions

351

Contributors

Representational state transfer (REST) is an architectural style that gives a coordinated set of constraints to the design of components in a distributed hypermedia system used to design networked applications. RESTful systems typically communicate over Hypertext Transfer Protocol (HTTP) with the same HTTP verbs (GET, POST, PUT, DELETE, etc.) that web browsers use to retrieve web pages and to send data to remote servers. REST interfaces with external systems using resources identified by Uniform Resource Identifier (URI) that can be operated upon using standard verbs.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hello All,

 I am connecting Exchange 2016 server remotely via PS script to manage the Mailbox rules for users, we have close to 1500 users for which we have to create/modify mailbox rules however when i run the script (from non exchange server) which first import the exchange session to powershell and then execute the commands to manage mailbox rules but it fails after running properly for a few users with the message "Get-InboxRule/ New-InboxRule" is not is not recognized as the name of a cmdlet, function, script file, or operable program". i.e it is trying to execute the command before it imports the exchange cmdlet into powershell, please note when i run it for a few users only it will work properly.

i have also provided delay in the PS script just after import exchange session/cmdlets command but it didn't help.

sample PS script code:

$username = "xyz"

$password = get-content D:\password.txt | convertto-securestring

$cred = new-object System.Management.Automation.PSCredential -argumentlist $username, $password

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri url -Credential $cred

Import-PSSession $Session

Start-Sleep -s 10

Rest commands to Manage Mailbox

 Note- i am using the proper url in -ConnectionUri, here it is not accepting url to be included in body so i am replacing my url with simply a name "url" :)

 

I have to call the script one by one for each user, hence the one time connection to exchange …
0
TCP/IP Network Protocol Cheat Sheet
TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

This plugin appears on a site I created as needing updating. I don't recall ever adding it.  Does anyone know what it is for and should I update it?
0
Hi,
I am testing the deployment of BITLOCKER via GPO.
For the moment I want to just encrypt the fixed drives without using TPM
I have created a TEST OU and moved a single computer to it.
I have created a GPO and edited/activated the following
Computer Configuration>Administrative Templates>Windows Components>BITLOCKER encryption
I have activated the following
Control the use of BITLOCKER on fixed drives:ACTIVE
Configure the encryption on the hardware level on the fixed drives:ACTIVE
Select the recovery method for recovery of fixed drives using BITLOCKER: ACTIVE
The rest is not configured.
Please note that I have the GUI in french so the translation might not be exact.

I have applied the GPO to the TEST OU
run gpupdate /force on the only computed within the OU
Restarted the computer
The GPO does not seem to apply
manage-bde -status and the bitlocker mmc show the the bitlocker DISACTIVE

What am I doing wrong or what do i need to add?
Please help.
Lenovo ThinkPad with running Windows 10

Are there any compatibilty issues with OPAL drives?


GPO Bitlocker
0
we have rest api in our project, we need to add swagger doc to my project..
provide me the references..
0
windows 7 and 2008 R2 standard.
i'd like for users to have local profiles on their main computer they use 95% of the time. but then still be able to roam once in a while and use other computers. is that possible? thanks
0
I'm trying to implement Rest API for BFM(BargainFindermax) in my project where SOAP calls are already implemented and working. Since Soap does not provide pagination options, I was trying to implement the same flight search functionality with REST "BFM" API.

After integrating the Rest calls through javascript http.post request, Rest calls are working but the returned results in REST "BFM" call are fewer than SOAP "BFM" call. Fare prices returned in REST call are expensive compared to soap results as well. The request body of REST call is exactly same as SOAP i.e. Cabin type, passenger details, origin/destination information, currency etc. are all forming just as it was in previously implemented SOAP call. REST Call does not seem to return any record against "SisterOriginMilage.Number" either.

For some reason, Rest BFM returns different, fewer and costly Itinerary results than SOAP BFM. Any idea what could be the reason for these different results? Any help would be much appreciated.
0
Hi All :)

my issue is most of the updates i try to install on the file server fails with [reverting back changes], i tried so many things with the server: clean boot - system file checker - chkdsk - restoring the image health using DISM from a WIM file - renaming the software distribution folder

i also tried to install the updates in the below link one by one in order from bottom to up with a restart in every installation but the server got the first 3 updates only (KB3172615 - KB3179575 - KB3185280), the rest failed with the message [reverting back changes]
https://support.microsoft.com/en-us/help/4009471/windows-server-2012-update-history

i hope someone can help me ASAP please, here is the log of my last installation attempt...

2017-08-12      10:38:17:896       540      1104      Misc      ===========  Logging initialized (build: 7.8.9200.16924, tz: +0200)  ===========
2017-08-12      10:38:17:896       540      1104      Misc        = Process: C:\Windows\system32\svchost.exe
2017-08-12      10:38:17:896       540      1104      Misc        = Module: c:\windows\system32\wuaueng.dll
2017-08-12      10:38:17:896       540      1104      Service      *************
2017-08-12      10:38:17:896       540      1104      Service      ** START **  Service: Service startup
2017-08-12      10:38:17:896       540      1104      Service      *********
2017-08-12      10:38:17:912       540      1104      Agent        * WU client version 7.8.9200.16924
2017-08-12      10:38:17:912       540      1104      Agent        * Base directory: C:\Windows\SoftwareDistribution
2017-08-12      10:38:17:912       540      1104      Agent        * Access type: No proxy
2017-08-12      …
0

Below is my code.
Web-sphere context path is set to simple slash /.

xml


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
 version="3.0">
 <servlet>
    <servlet-name>RestServlet</servlet-name>
    <servlet-class>javax.ws.rs.core.Application</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>RestServlet</servlet-name>
    <url-pattern>/users/*</url-pattern>
</servlet-mapping>
</web-app>

Open in new window



appln

package com.ibm.jaxrs.sample;

import java.util.HashSet;
import java.util.Set;

import javax.json.JsonWriter;
import javax.ws.rs.ApplicationPath;

@ApplicationPath("/users")
public class HelloWorldAppConfig extends javax.ws.rs.core.Application {
	   
	   public Set<Class<?>> getClasses() {
	      HashSet<Class<?>> set = new HashSet<Class<?>>();
	      set.add(HelloWorldResource.class);
	      System.out.println("Completed application getclasses");
	      return set;
	   }

}

Open in new window



resource

package com.ibm.jaxrs.sample;

import javax.ws.rs.core.*;
import javax.ws.rs.*;
import javax.servlet.http.HttpServletRequest;

import javax.ws.rs.core.Application;

@javax.ws.rs.Path("/show")
public class HelloWorldResource {

	private static final String LINK_SELF = "self";
	public HelloWorldResource() {
		// TODO Auto-generated constructor stub
    	System.out.println("Got inside constructor");
	}
	
	@GET
	@POST
    @Produces(MediaType.TEXT_PLAIN)
	@Path("/show")
    public Response getAll(@Context UriInfo uriInfo) {
		System.out.println("Completed application getsingleton");
        return Response.ok("Hello").build();
    }//@Produces( MediaType.APPLICATION_JSON )
	
 }

Open in new window



included jars in WEB-INF\lib foler


com.ibm.jaxrs2.0.thinclient_9.0.jar
com.ibm.jaxws.thinclient_9.0.jar
com.ibm.ws.ejb.portable_9.0.jar
com.ibm.ws.ejb.thinclient_9.0.jar
com.ibm.ws.jaxrs20.tools.jar
cxf-rt-frontend-jaxrs-3.1.12.jar
cxf-rt-rs-client-3.1.12.jar
cxf-rt-rs-extension-providers-3.1.12.jar
cxf-rt-rs-extension-search-3.1.12.jar
cxf-rt-rs-json-basic-3.1.12.jar
javax.ws.rs-api-2.0.jar

Open in new window

0
Dear Sirs,
Below is a Jersey code.  I would like to set the functionality in my Spring REST application. The code filters requests and abort if necessary.
@Provider
public class MyFilterServerRequestAuth implements ContainerRequestFilter {

    @Override
    public void filter(ContainerRequestContext requestcontext) throws IOException {
        
        String apikey = requestcontext.getHeaderString("x-api-key");
        String apisecret = requestcontext.getHeaderString("x-api-secret");
        
        if (!FingerAppSettings.API_KEY.equalsIgnoreCase(apikey) || !FingerAppSettings.API_SECRET.equalsIgnoreCase(apisecret)) {
            MyResponseEntity entity = new MyResponseEntity(
                    Response.Status.UNAUTHORIZED.getStatusCode(),
                    MyAppDictionary.getMessageAccessDenied(),
                    requestcontext.getUriInfo().getAbsolutePath()
            );

            requestcontext.abortWith(
                    Response
                            .status(Response.Status.UNAUTHORIZED)
                            .entity(entity)
                            .type(MediaType.APPLICATION_JSON)
                            .build()
            );
        }

    }

}

Open in new window

0
I dont want to re-invent the wheel and build a new WCF or Rest webservice. Please advise, how can I find out if the service I need has already been created by someone? I would love to be able to re-use that WCF/Rest service.

Example: I need a service that would convert currencies.

Thanks,
Ricky
0
Automating Terraform w Jenkins & AWS CodeCommit
Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

I have a web part page displaying 5 web parts. Four of the web parts (Efforts, Phases, Capture Points & Areas) are "provider" web parts, and come from lists that are the sources of 4 lookup columns in the 5th "consumer" web part (Lessons Learned).

The provider web parts are displaying the Title column from the lists.

The Using Javascript/jQuery, I "connected" the 4 provider web parts to the consumer web part, such that when you click on a Title column value, the consumer web part is filtered to show only those records that have the clicked value in the relevant metadata column.

All that is working very nicely.

Now, my requirement is to go one step further, and display the number of items that will be displayed if you click on a Title column value in any of the 4 web parts. If there are none, a "0" should be displayed.

I've constructed a lists service query that successfully returns the number of items that exist for a given, hard-coded, metadata value:
[SiteURL]/_vti_bin/listdata.svc/[ListName]/$count?&$filter=Effort/Title eq 'AAA'

So, the goal is to display such an item count beside the corresponding provider web part value, such as:
Efforts web part:
AAA (10) //assuming there are 10 items in the consumer web part tagged with Effort 'AAA'

Now, I'm bumping up against the current limit of my abilities.

I know that I need code (javascript, rest, ajax, json) for each provider web part with looping to cycle through all of the TD cells that have …
0
I'm trying to implement a restful architecture using .NET Core based on HATEOAS.

For that, I would be using an include parameter with a list in the GET requests so as to include the entities related to the parent.

For example, if I want to get a master (master/details) with the related client I would perform the following GET request:

GET http://api.com/master/id=1?include=Client

Open in new window

If the include clause is not there, the related client in the master will only show the link to get it.

The will happen with every related entity.

What I'm trying to find out is the best way to implement this in my base resource's class.

The solution I applied is to use a base class using generics:

public class InstanceResource<T> where T : BaseResource
{
    public string Href { get; set; }

    public string ClassName { get; set; }

    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
    public T Object { get; set; }
}

Open in new window

Using this, I will have a Master with a InstanceResource related to it.

The object property of InstanceResource<Client> is the actual Client object. If Client is not included in the Include clause of the GET request, the object will be null and it will only show Href and ClassName.

GET http://api.com/master/id=1?include=Client
{
  "object": {
    "client": {
      "object": {
        "name": "JOHN DOE"
      },
      "href": "http://api.com/client/1",
      "className": "Client"
    },
    "details": {
      "href": "http://api.com/details/masterId=1",
      "className": "Collection<Detail>"
    }
  },
  "href": "http://api.com/master/1",
  "className": "Master"
}

Open in new window

Not included Client:

GET http://api.com/master/id=1

{
  "object": {
    "client": {
      "href": "http://api.com/client/1",
      "className": "Client"
    },
    "details": {
      "href": "http://api.com/details/masterId=1",
      "className": "Collection<Detail>"
    }
  },
  "href": "http://api.com/master/1",
  "className": "Master"
}

Open in new window

As you can see, this approach uses a container class to represent the resource. What I need to know if this solution has any disadvantage.

I saw other solutions where all the properties of the Object are at the same level that Href. Something like this:


Open in new window

0
I need to create a set of InfoPath forms and upload them with updated data to a document library.  I have put together some JavaScript which accomplishes this, but the upload of the document (InfoPath doc) is async and the code works fine when I run it in the debugger, but if I run the loop with no breakpoints, the browser hangs on the create/upload of the file.

I am not sure if it is that the function is async or that it appears to be CSOM whereas all my other code is using REST.  

Any help/ideas on this would be greatly appreciated.
0
Hi,

We are developing code in order to do requests to webservices. I am looking  for online webservices that I can use in order to test the next two kind of requests:
- a PUT request
- a request with a HttpHeader

Both SOAP and REST requests.

Anyone a idea for an online application I can use?

Regards,

Arne
0
For two years our vb.net sync app has been running quite successfully hosted on Azure. It gathers recent Db updates and additions from a SQL Db and transposes them on a schedule into the MySQL Db behind a Wordpress site.

The only problem comes when there are two many records to update/add. Then it is prone to either fail or abort in Azure. This happens typically when there are over 500 records to process and the program running time exceeds an hour or two.  We have worked with the Azure team extensively to try and prevent this, but it keeps happening.

We would like to experiment working with the Wordpress REST Api therefore, to see whether time is saved, and efficiency is improved, over the app's current direct SQL calls to the MySQL Db.

The thing is, I'm struggling to find any documentation about how to incorporate the WP REST Api calls in a VB.net application. Does anyone have any examples of how this should be done?

Thank you
0
Dear Sirs,
I have a web app rendering html and exposing at the same time some REST end points.
I have 2 two classes annotated with @ControllerAdvice:
1) A Class will manage all the errors generated on the web side of the application, and redirects to an Error view page
2) The other Class will manage all the errors generated on the REST side of the application and returns an ResponsEntity<Object>

I have some custom exceptions such as NotFoundException, AccessDeniedException, etc.. And there is a generic ExceptionHandler for the Class Exception.class in both the 2 @ControllerAdvice Classes: 1 for web side exception and 1  for REST side exception.

The confusion  I am seeing is that when the generic exception occurs, while I am consuming the REST end points, I will get an HTML error view instead of a Jackson string representing the ResponseEntity<Object> and vice-versa.

How can I handle this. Make @ControllerAdvice Class 1 only look at exceptions generated by all the classes annotated with @Controller, and @ControllerAdvice Class 2 only look at exceptions generated by all the classes annotated with @RestController.


Thanks a in advance
0
Dear sirs,

I have CSRF enabled in my REST application.
I use either RestTemplate or Postman as Client.
How can I set the application in a way that each request (POST/PUT/DELETE) is carried with a token in its header.

I remember using an implementation of  ContainerRequestFilter while working on Jersey, and I could take care of my requests globally.

I am looking forward to hearing from you.
0
I have a user form that is created in extjs framework. The user form has many user fields which are being passed as part of request payload to the REST controller. I am trying to add a grid panel(most likely in a tabular format with multiple rows & columns) to the user form. But I am not sure how to pass the grid panel data as part of request payload to the REST controller. I will post more code if any more details are needed. Any help would be appreciated. Thanks.

Ext.define('soylentgreen.view.admin.UserForm', {
    extend : 'Ext.form.Panel',
    alias : 'widget.userform',
    bodyStyle : 'padding:5px 5px 0',

// some userform elements like firstname,lastname, go here.....

name : 'userTeamGrid',
  xtype : 'gridpanel',
id : 'userTeamGrid',
itemId : 'userTeamGrid',
multiSelect : true,
selModel : Ext.create(
        'Ext.selection.CheckboxModel',
        {
          injectCheckbox : 'first',
          mode : 'MULTI',
          checkOnly : false
        }),
anchor : '100%',
width : '700px',
height : 250,
flex : 1,
store : 'userTeamStore',

var user = form.getRecord();
form.updateRecord(user);
user.save({
        callback : function(records, operation){
          //reset the (static) proxy extraParams object
          user.getProxy().extraParams =  {
            requestType: 'standard'
          }
          if(!operation.wasSuccessful()){
            var error = operation.getError();
0
I have an XML file that when passed through SOAP UI returns a proper response as XML file. I need to create an application to pass the XML and recuperate the response. I tried searching but many say REST web service where they using only post/get.

Please send me some sample code and/or tutorials.
0
Important Lessons on Recovering from Petya
LVL 10
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

I am exporting a table using pdfmake
The table exports, but there is one item that is 'undefined'.  

I have a main page with multiple tabs and once you hit the 'Printer Friendly' btn, a pdf report opens in a new tab for the specific tab you selected.  The 'printer friendly' btn is what exports the page.  

This code broadcasts  the print function to produce the pdf report depending on what tab you are on.
$scope.printDiv = function(divName) {		
		$rootScope.$broadcast('print');		
	}
	

Open in new window


and the button
<button ng-click="printDiv('rollup-tab')">Printer Friendly</button>

Open in new window



Here is the rest of the code.

Table creation and exports the pdf pdf
$scope.$on('print', function(event, filter) {
			var docDefinition = {

					content: [	
					          {
						  table: {

					              body: [                   			                
					                [ 
					                  '',
					                  'Actual Pieces Issued',
					                  {text: $filter('mcGoalNumberFilter')($scope.actualPiecesMCGoal) + ' /wk'},			                  
					                  {text: $scope.actualPiecesMon, style: 'tableData'},
					                  {text: $scope.actualPiecesTues, style: 'tableData'},
					                  {text: $scope.actualPiecesWed, style: 'tableData'},
					                  {text: $scope.actualPiecesThurs, style: 'tableData'},
					                  {text: $scope.actualPiecesFri, style: 

Open in new window

0
i want to send email notification to few external users .

Tried using designer 2013 /2010 workflow.

Also tried JSom code using Rest Api
0
Hello Guys , i need a GPO for work life balance , just locking computer automatically after 4 hrs of activity and unlock it after 10 min of rest
0
I am working with excel 2007 and I have changed my printer settings, selected all then changed the page set up, changed in print settings while under print entire workbook. All three option print the first page in color and the rest black and white and double sided. Right now I am going tab by tab to update the page setup - is there a better way to do this though.
0
Dears,
Some servers over the network I can open normally like \\severname\c$ with no issue but the rest of the servers I can't like I don't connect to the network.
I have windows 10 and this is normal netwrok with Microsoft active directory. The other machine I can connect and do it by my users to access all servers but not from my machine anymore.
Regards
Mostafa
0
Why can't we write an efficient query to check if any results are not started with a set of alphabets? I am using this https://wordpress.org/plugins/alphabetic-pagination/ but i don't know that how can i check if rest of the alphabets are not having any results in it.
0

REST

172

Solutions

351

Contributors

Representational state transfer (REST) is an architectural style that gives a coordinated set of constraints to the design of components in a distributed hypermedia system used to design networked applications. RESTful systems typically communicate over Hypertext Transfer Protocol (HTTP) with the same HTTP verbs (GET, POST, PUT, DELETE, etc.) that web browsers use to retrieve web pages and to send data to remote servers. REST interfaces with external systems using resources identified by Uniform Resource Identifier (URI) that can be operated upon using standard verbs.