REST

352

Solutions

650

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

Good afternoon everyone.   I was wondering if anyone had any experience using the My Fax application.   Currently one of our customer is using the service to send outbound faxes directly from their EMR application.   The majority of the fax numbers associated with the EMR application they send to are coming through without a problem.   There is one fax number (which I believe to be an analog line) when sending , the EMR application shows the fax sends and completes the send however only partial pages are coming through.   This is only happening with 1 fax line out of the rest.   According to the vendor they did state this.

"Good afternoon. Pls note that this change reflects ALL faxes sent. In our experience, this raises a few additional issues:
 
1) Additional Support Calls in to our team as to why the failed confirmations are delayed (ie could take up to 30 minutes to produce a failed confirmation)
2) If the line we are dialing is of poor quality and cuts off multiple times mid transmission, we will still try multiple times to deliver that fax meaning that they would receive partial faxes…."

Where specifically can I look to find out where the break is happening?   Is there a way to verify if the line quality is poor?  Or if not, and the fax is making it to the destination could the drop happen on the way they are processing the inbound transmission on their end?

Here is some additional information from the vendor..

I have investigated and tested the number …
0
Exploring SharePoint 2016
LVL 13
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

I have a thirdparty rest api and angular js frontend project that I inherited.

data is in json, and the code iterates over the collection and displays it.
as I don't have control over the api and what it returns , I want to hide certain items in the collections.

what are my options in angularjs?
0
Hi Experts,

I am facing the below issue while hitting the REST service request from soapui.
java-1.8
soapui-5.5.0

Exception:
exception in thread "main" java.lang.assertionerror: failed generating bytecode

used below link for sample:
https://www.soapui.org/rest-testing/getting-started.html


Suggest me how to resolve this issue.
0
We have a NetCore web application and we are looking for an SDK or REST API that will parse data in PDF files.
If we upload a PDF file with specific fields we need for the PDF Parser to extract the data in those fields and arrange it into XML or JSON so that we can then use it any way we want.

I found a couple software companies that have this type of PDF Parser but I want to do more research on this. Any recommendations?  Do you have any experience with the recommended software?
0
Hi Experts!

I have been using DataSnap REST for some weeks but I have problems understanding some concepts related to TJSONObject and how these data are sent.
I have three related questions.
I consider a simple class:


TMyclass = class
  private
    [JSONName('name')] // invio
    Fname: string;
    [JSONName('surname')] // invio
    Fsurname: string;
    [JSONName('mytext')] // invio
    Fmytext: string;

    procedure Setname(const Value: string);
    procedure Setsurname(const Value: string);
    procedure Setmytext(const Value: string);
  public
    property name: string read Fname write Setname;
    property surname: string read Fsurname write Setsurname;
    property mytext: string read Fmytext write Setmytext;
  end;
  
.....

procedure TMyclass.Setname(const Value: string);
begin
  Fname := Value;
end;

procedure TMyclass.Setsurname(const Value: string);
begin
  Fsurname := Value;
end;

procedure TMyclass.Setmytext(const Value: string);
begin
  Fmytext := Value;
end;  

Open in new window


.....

In my code I have something similar to:

Procedure TMain.Send_JSON;
var
   VJSONObject: TJSONObject;
   VMyclass:TMyclass;
begin
   VMyclass:=TMyclass.Create;

   VMyclass.name:='John';
   VMyclass.surname:='Ace';
   VMyclass.mytext:='';

   VJSONObject:=TJson.ObjectToJsonObject(VMyclass);
   //...
   
   RESTClient1.ResetToDefaults;
   RESTRequest1.ResetToDefaults;
   RESTResponse1.ResetToDefaults;
   RESTClient1.BaseURL:='http://111.222.333.444:8080/datasnap/rest/mypath';
   RESTRequest1.Timeout:=RESTRequest_Timeout;
   
   RESTRequest1.Resource:='/MyParam'; 
   RESTRequest1.Method:=TRESTRequestMethod.rmPOST; 
   RESTRequest1.AddBody(VJSONObject.ToJSON, ContentTypeFromString('application/json'));
   //...
   RESTRequest1.Execute;
   //...
end;

Open in new window



[First question]
When I send this JSON:
         {"name":"John","surname":"Ace","mytext":""}
i don't want to have:
"mytext":""
in the JSON.

[Second question]
I don't know a way to insert a JSON array like this:
{"name":"John","file": [{"name_file":"myfile1.txt","dir_file":"C:\mydir"},{"name_file":"myfile2.txt","dir_file":"C:\mydir2"},...]}

[Third question]
I am looking for a method to manipulate the:

VJSONObject.ToString

before insert in the:

RESTRequest1.AddBody(VJSONObject.ToJSON,...

but I couldn't find it. I search something like:

  VJSONObject := Json.StringToJsonObject(VJSONObject.ToString);

I have a lot of problems because there is no documentation on this part.
Does anyone have a solution?


Working with RAD Studio Tokyo 10.2.3
0
I have working with an Rest api, which returns json data, but not sorted out the way I want. Api is not flexible enough, such that we can pass a sort parameter and it returns the result accordingly.

so, the data in such form

public class records {

....
      public Collection<Item> items ;

.....

}


in my c# code, I do something like this,


var results = CallApi();


var sortedResults = results.OrderBy(x => x.items.price);

return soretedResults.tolist();


I am concerned that this sorting and converting it back to the list , is expensive and as the results
grow larger, this might cause problem.

any thoughts in this?
0
HI,
I have a question about rest call.  I have a rest call, which with token, but I got a status code :999. why it will return 999?
There is no response come back.

Thanks
0
I'm working on an old angular project,
in one of my HTML page I have  this,

<tr class="abc" data-ng-repeat="items in vm.products">

this iterates through the item in the product list , return by the rest call , by the looks of it. I wanted to sort it by a particular data field.

so if the rest calls return json data as such
{
   id: ...
   name : ...
   price : ...
   quantity : ...
...
}

to sort it by price, can just change the code to --> data-ng-repeat="items in vm.products | orderBy:'price' "

just adding this to HTML page, didn't work.

do i have to change any other code for this?
0
Hello everyone. I am trying to build a soap/rest webservice using Yii2. I cannot figure out how to route to the specific controller depending on the url.
It should work as follow:

For REST:
url: http://mydomain/rest/service/v1/action/param1/param2/...
responseType: JSON

For SOAP:
wsdl: http://mydomain/soap/service/v1/?wsdl
url: http://mydomain/soap/service/v1/
responseType: XML

I have many services published using my own implementation but I would like to use yii2.

Do you have any idea?

Thanks in advance

I have seen that adding this to yii configuration will do the trick (at least for REST):

 'rules' => [
                [
                    'class' => 'yii\rest\UrlRule',
                    'controller' => ['rest'],
                    'pluralize' => false,
                    'extraPatterns' => [ ],
                ]
],

Open in new window

0
I am trying to integrate a carousel that can be used / controlled with swipe gestures: Swiper.

This is how the page structure looks like:

<!-- Swiper -->
  <div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide">Slide 1</div>
      <div class="swiper-slide">Slide 2</div>
      <div class="swiper-slide">Slide 3</div>
      <div class="swiper-slide">Slide 4</div>
      <div class="swiper-slide">Slide 5</div>
      <div class="swiper-slide">Slide 6</div>
      <div class="swiper-slide">Slide 7</div>
      <div class="swiper-slide">Slide 8</div>
      <div class="swiper-slide">Slide 9</div>
      <div class="swiper-slide">Slide 10</div>
    </div>
    <!-- Add Pagination -->
    <div class="swiper-pagination"></div>
  </div>

  <!-- Swiper JS -->
  <script src="../dist/js/swiper.min.js"></script>

  <!-- Initialize Swiper -->
  <script>
    var swiper = new Swiper('.swiper-container', {
      pagination: {
        el: '.swiper-pagination',
        dynamicBullets: true,
      },
    });
  </script>

Open in new window


As I am using jQuery to retrieve the data from the server. Once the document has loaded, I collect all the items from the server using a REST API call, I generate the <img> tags with the appropriate src (location of the picture) and then I put them all into an array called allWidgetPictures[].

I use the following function to update the DOM:

      /**
       *@description Retrieves all picture URL for the carousel function
       */
      this.retrieveAllWidgetPictures = function() {
        for (i = 0; i < app.allWidgetPictures.length; i++) {
          console.log(app.allWidgetPictures[i] );
          $("#swiper-wrapper").after(app.allWidgetPictures[i] );
          
        }

      };

Open in new window


Is there anything else that I need to do in order to update the page, as the <img> tags do not appear after the <div swiper wrapper>.
The array is properly populated:

Annotation-2019-05-29-013803.png
Am I missing anything or why is the page not updated with all the <divs>?
0
Rowby Goren Makes an Impact on Screen and Online
LVL 13
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

I need a way of pulling car trade-in values from kbb.com or some other source into this Google spreadsheet https://docs.google.com/spreadsheets/d/19x5gqcy-9CCaoguq5aFOlY-W1P7H6HaqYxjp3PQLoAM/edit#gid=288072689.
0
Hi Experts,

How can I give a user permissions to one VM in Hyper V without giving them local admin or Hyper V administrator access to the rest of the virtual?  So far the options to do this I am finding our outdated or I'm not seeing those options.

We have 1 Hyper V server, not clustered.
2016.

Thank you,

Karen
0
Hi,

I want to wrap a lambda function, which sets DesiredCapacity to 0, to a Rest API.

This is my lambda - it works fine

exports.handler = (event, context, callback) => {

  const AWS = require('aws-sdk');
  var autoscaling = new AWS.AutoScaling();

  var paramstestpdf = {
    AutoScalingGroupName: "awseb-e-ygxcpvxwv5-stack-AWSEBAutoScalingGroup-xxxxxxxx", 
    DesiredCapacity: 0, 
    HonorCooldown: true
  };
  
    var paramstestsched = {
    AutoScalingGroupName: "awseb-e-mnq4mpfjuw-stack-AWSEBAutoScalingGroup-xxxxxxxx",
    DesiredCapacity: 0, 
    HonorCooldown: true
  };
  
      var paramstestcloudagent = {
    AutoScalingGroupName: "awseb-e-2mhm4z3amt-stack-AWSEBAutoScalingGroup-xxxx",
    DesiredCapacity: 0, 
    HonorCooldown: true
  };
  
     var paramstestnotifications = {
    AutoScalingGroupName: "awseb-e-sjppyxakq2-stack-AWSEBAutoScalingGroup-xxxxx",
    DesiredCapacity: 0, 
    HonorCooldown: true
  };
  
    var paramstestnode = {
    AutoScalingGroupName: "awseb-e-fwyg2xkzqq-stack-AWSEBAutoScalingGroup-xxx",
    DesiredCapacity: 0, 
    HonorCooldown: true
  };
  autoscaling.setDesiredCapacity(paramstestpdf, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
  }
  );
  
    autoscaling.setDesiredCapacity(paramstestsched, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           

Open in new window

0
In AWS we have Lambda code and rest of the project is using AWS Glue code. Now, I need to have 2 Jenkins configurations in one yaml file one is for lambda and one is rest of the project. How can i achieve this?

Deployment script for Serverless and rest of the project in single yaml file with two different Jenkins configurations.

Thanks in advance.
0
We use exchange 2013

We have mailbox say “mailbox1”.

About 30 people have access to mailbox1.
Say one of user who got access to mailbox1 is John.

When John sends email on the behalf of mailbox1 the actual email goes to sent items folder of John in outlook.
We are trying to find the way so when John sends email on the behalf of mailbox1 it goes to sent items folder of Mailbox1(not John).
And we want to apply same for rest of users we got access to Mailbox1

Is this possible?

We have limitation that outlook can’t be used on “cached exchange mode” because user access outlook via Citrix.
0
Experts,
 We have sharepoint 2013 environment. We have one custom Access Denied page where i added javascript code to check current user is part of group or not. I am getting userid from"_spPageContextInfo.userId" and use below rest api code to access username.

var ctx = new SP.ClientContext.get_current();
        this.web = ctx.get_web();
        this.currentUser = this.web.get_currentUser();
alert(currentUser);
var userid= _spPageContextInfo.userId;
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")";
var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
    url : requestUri,
    contentType : "application/json;odata=verbose",
    headers : requestHeaders,
    success : onSuccess,
    error : onError
});

Open in new window


Now when user does not have permission for that page and access then it's read the user id but it's authenticate fail for rest api.  Below is the error message.

 HTTP401: DENIED - The requested resource requires user authentication.
(XHR)GET - http://server/_api/web/getuserbyid(47)

How to resolve this problem? I want to read current username from that page. Is there any way that rest api will not fail?
0
I have a service which has a REST endpoint which returns a simple LIST containing Events and the event descriptions. I have been asked to return the output in standard JSON format. Is this just a matter of adding , RequestFormat = WebMessageFormat.Json &    ResponseFormat = WebMessageFormat.Json to the operation contract or is there more to it than this ?
0
I'm trying to set up an SSL endpoint on my server (Windows Server 2012 R2) so that it can receive https POSTs from an external server. I am using a simple REST framework for Powershell called RestPS: https://github.com/jpsider/RestPS to listen on port 8089 and I have an SSL certificate that I'm trying to use but I am getting errors when I try to use it. I'm very much a novice with SSL certificates and need some help. When I run Start-RestPSListener in Powershell, I get these messages:

SSL Certificate deletion failed, Error: 2
The system cannot find the file specified.

SSL Certificate add failed, Error: 1312
A specified logon session does not exist. It may already have been terminated.

Starting: https:// Listener on Port: 8089

Open in new window


I'm not sure what those errors mean or if they matter. But something isn't right because when I try to POST from the external server I get an 'unknown SSL protocol error' connecting to my server.

I've looked at the certificate stores using the MMC and there's a bunch of stuff in there, but it's all very confusing to me.

Not sure if this is related: I'm also running Apache on this server, and it is listening on port 443 using the same SSL certificate. It is working fine and receiving POSTs.

Also, here's what I'm getting from the external/remote server trying to POST to my server:

 Trying <<ip address>>...
Name '0.0.0.0' family 2 resolved to '0.0.0.0' family 2
Local port: 0
Connected to <<domain name>> (<<ip 

Open in new window

0
Hi,
 We have sharepoint list view where user filter and sort data. Now we would like get sorting and filter parameters and generate rest api url by script editor to fetch some list items. is it possible to read filter and sorting parameter by url or ctx object?

There is a object ctx.ListData.Filterlink gives some parameters but it's in another format.

"?FilterField1=LinkTitle&FilterValue1=A&SortField=LinkTitle&SortDir=Asc&PageView=Shared&"

Here is the REST Api url where i need to add filter and sorting parameters.
 url: siteUrl + "/_api/lists/getbytitle('Test_Custom_List')/Items?$select Title",



 <script>
var siteUrl = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl;
 
jQuery.ajax({
  // need to generate dynamic url based on filter and soting on page
    url: siteUrl + "/_api/lists/getbytitle('Test_Custom_List')/Items?$select Title",
    type: "GET",    
    headers: { 
        "accept": "application/json;odata=verbose",
        "content-type":"application/json;odata=verbose",
        "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
    },
    success: function(d) {
        var stringData = JSON.stringify(d);
        var jsonObject = JSON.parse(stringData);
        var results = jsonObject.d.results;
        for(i = 0; i < results.length;i++) {
            console.log(results[i]["Title"])
        }
    },
    error: function() {
        console.log('fail');
    }
});
</script>

Open in new window

0
HTML5 and CSS3 Fundamentals
LVL 13
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Please reference the solution to my previous question:

PowerShell:  Move from using arrays/looping into objects/pipelining

This has been working on the inital data sets but these were quite small.  Now that the QA team is actually loading devices, the script fails to write the results to the file.  Here is the current code:
# Get all mobile devices from JAMF
$JAMFfile = $FilePath + "\JAMF_Prod.csv"

$BaseURL = "https://" + $JAMFAPIServer + "/JSSResource/mobiledevices"
$Header = @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($JAMFAPIUser+":"+$JAMFAPIPassword))}
$Type = "application/json;charset=UTF-8"


Try 
{

    $MobileDeviceResponse = Invoke-Restmethod -Uri $BaseURL -Method GET -ContentType $Type -Headers $Header
    $MobileDeviceResponse.mobile_devices.mobile_device |
        Select-Object -Property name, 
                         id,
                         serial_number,
                         model,
                         @{n="department";e={ 
                                (Invoke-Restmethod -Uri "$BaseURL/id/$($_.id)/subset/location" -Method GET -Headers $Header).mobile_device.location |
                                 Select-Object -ExpandProperty department}},
                         @{n="building";e={ 
                                (Invoke-Restmethod -Uri 

Open in new window

0
We are getting rogue IP addresses and when that is happening we are having intermittent connectivity.  We have 2 dhcp servers, one windows for school and one through Sonic wall for rest of complex.  we moved our servers to a new server room and started having this issue.  We didn't change anything else.  We have unifi wifi and witches, NO USG and cant figure this out.  I have a meeting I have to be at in 13 minutes, so please ask away and I will get you as much info as I can.  We have restart we have done as much as we can think of and it is mostly one set of Atom Win 10 Notebook/Tablet computers having this issue.  And connectivity is noticed with our HVAC, automated logic.  Also if I  ping my cloud key, I get about 1/3 that don't return.

Also, school is on a 10.10.X.X 255.255.252.0 and church side is 192.168.0.1/24  we need to be clear what is behind content filter is the reason for the two subnets.

The screen shot is what we get when the Atom win 10's loose connectivity.

Remember I just a priest and I do this cause we are a poor church with a school, so be gentle...

Thanks again.
123_1.jpg
0
I was thinking about magnetism and it seems that both immobile charges are affected.

We have a wire conducting current and we have a positive charged cat.

At our rest frame the cat won't be repulsed from the wire . But in another frame when we consider the electrons (which are the current) immobile then due to length contraction the charge density of both the cat and the nuclei will be increased so a repulsive force will exist.
0
Hi Expert,

Could anyone please share how to create REST web service using ORDS ?

Please share with some real-time demo scenario.

Your comment is always Appreciate ..

Thanks..
0
Have DRF View based on APIView , from which I'm getting queryset as a list of tuples.
I need to serialize this queryset and pass it to rest_framework.response.Response object as a result, i.e. serializer.data.
How should Serializer class look to accomplish this task?

class SomeView(APIView):

    def post:
        result = cursor.fetchall()
        serializer = SomeSerializer(result)
        return Response(serializer.data)

Open in new window


How should I render result in SomeSerializer class? Can you give me working implementation of that?

P.S. Thera are no any model related to these results in the system.
0
I m using Nginx as webserver to serve some file. and here is the folder structure to be servered.


 #tree .
.
├── 1
│   ├── a.png
│   ├── attachment
│   │   └── b.png
│   └── employeeImage
│       └── a.png
├── 10
│   ├── attachment
│   └── employeeImage
│       └── a.png
├── 11
│   ├── attachment
│   └── employeeImage
│       └── a.png
├── 12
│   ├── attachment
│   └── employeeImage
│       └── a.png
├── 2
│   ├── attachment
│   │   └── b.png
│   └── employeeImage
│       └── a.png
├── 20
│   ├── attachment
│   └── employeeImage
│       └── a.png
├── 21
│   ├── attachment
│   └── employeeImage
│       └── a.png
├── 3
│   ├── attachment
│   │   └── b.png
│   └── employeeImage
│       └── a.png
├── 30
│   ├── attachment
│   └── employeeImage
│       └── a.png
├── 4
│   ├── attachment
│   │   └── b.png
│   └── employeeImage
│       └── a.png
├── 40
│   └── employeeImage
│       └── a.png
├── 5
│   ├── attachment
│   │   └── b.png
│   └── employeeImage
│       └── a.png
├── 6
│   ├── attachment
│   │   └── b.png
│   └── employeeImage
│       └── a.png
├── 7
│   ├── attachment
│   │   └── b.png
│   └── employeeImage
│       └── a.png
├── 8
│   ├── attachment
│   │   └── b.png
│   └── employeeImage
│       └── a.png
└── 9
    ├── attachment
    │   └── b.png
    └── employeeImage
        └── a.png



out of this io need only employeeImage/ to be available to the public.




and rest of the …
0

REST

352

Solutions

650

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.

Related Topics

Top Experts In
REST
<
Monthly
>