REST

155

Solutions

1

Articles & Videos

314

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

I am using REST API with SharePoint 2013 and I want to know if the following url endpoint is legal or if there is a better way?
 //http://myspsite.com/nrm/_api/web/lists/getbyTitle('My_Project_Modules')/items?$select=DIR,Station,Title,Building_x0020_Number&$filter=Project_x0020_Number eq '402-CSI-001'     //<---  Works when I paste it in the browser
 var projNum = '402-CSI-001';
var endPointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbyTitle('My_Project_Modules')/items?$select=DIR,Station,Title,Building_x0020_Number&$filter=Project_x0020_Number eq "+projNum;  //<---  Not valid when I run it in my code

Open in new window


Error I get in my js file
rest api error
js file
function loadSPItems() {
var projNum = '402-CSI-001';
var endPointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbyTitle('My_Project_Modules')/items?$select=VISN,Station,Title,Building_x0020_Number&$filter=Project_x0020_Number eq "+projNum;//,ProjectNumber,ApprovalStatus,ProjectExecutionStatus”;
var headers = { 
	"accept": "application/json;odata=verbose" 
}
 
jQuery.ajax({ 
	url: endPointUrl, 
	type: "GET", 
	headers: headers, 
success: function (data) {
	console.dir(data);
}, 
	error: function (err) { 
	alert("Error Occured:" + JSON.stringify(err)); 
}
 
});
 
}

loadSPItems();

Open in new window




Thoughts?
0
Enroll in June's Course of the Month
LVL 9
Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

I have a simple REST Api app and have no issues when sending a GET request, everything works as expected. However, when I send either a PUT, POST or DELETE request, I just get 204 - No Data response and none of the code in the relevant methods is executed.

This what I have in my WebAPIConfig.vb file:

Public Module WebApiConfig
    Public Sub Register(ByVal config As HttpConfiguration)
        ' Web API configuration and services

        ' Web API routes
        config.MapHttpAttributeRoutes()

        config.Routes.MapHttpRoute(
            name:="DefaultApi",
            routeTemplate:="api/{controller}/{id}",
            defaults:=New With {.id = RouteParameter.Optional}
        )

    End Sub

End Module 

Open in new window


and the PUT method in the controller is simply logging the fact we got a request, but the code doesn't run:

' PUT: api/Barcode/5
        Public Sub PutValue(ByVal id As Integer, <FromBody()> ByVal value As String)

            auditLog("REST Call", "Received PUT request", False, False)

        End Sub

Open in new window

0
Hi All,,,

Requirement is as follows:
(It may sound crazy or stupid but I welcome any better suggestions).
- I am pulling out a set of records in a Continuous Form based on a selection Query.
- When I update a text field, I want the change to reflect in the same field in the rest of the record set.

I did an Update Query which I run in the 'After Update event'  of the field.
Two scenarios:
1- When I include a Saverecord in the update event after running the Updating Query, I get the attached Error Message.
2- If I don't Saverecord in the AfterUdate, then I get caught with the same error message upon closing the form.

In both cases, the update query does its job very well.

On the Error Message:
- If I choose 'Copy to Clip Board', 'Save Record' or 'Drop Changes', nothing happens and  I can continue to close and nothing is affected to the updated fields.

I have observed the behavior very closely and it is fine EXCEPT the annoying Error Message, which sounds scaring.

Please advise of :
- Either a way to suppress the Error Message, or
- A better suggestion to achieve the requirement.


Many Thanks

BTW:
This is not a multiuser environment not even a split DB. It is confined to my PC only as it is still under development .

Write Conflic1
0
How to parse the  JSON Data using Rest web service give me a simple example
0
Hi Experts,

I have created a google rest api call using postman and can successfully retrieve an email from my gmail account. However, I need to extract some text from the body and it is coming back encrypted such as below

 "body": {
          "size": 2717,
          "data": "PCFkb2N0eXBlIGh0bWw-DQo8aHRtbD4NCjxoZWFkPg0KPG1ldGEgY2hhcnNldD0iVVRGLTgiPg0KPHRpdGxlPkNvbXBsZXRlIHlvdXIgUmVnaXN0cmF0aW9uPC90aXRsZT4NCjwvaGVhZD4NCg0KPGJvZHkgc3R5bGU9ImZvbnQtZmFtaWx5OkdvdGhhbSwgJ0hlbHZldGljYSBOZXVlJywgSGVsdmV0aWNhLCBBcmlhbCwgc2Fucy1zZXJpZjsgbGluZS1oZWlnaHQ6MS42ZW07IGZvbnQtc2l6ZToxNHB4Ij4NCjwhLS1baWYgbXNvXT4NCgk8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCQlib2R5LCB0YWJsZSwgdGQge2ZvbnQtZmFtaWx5OkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYgIWltcG9ydGFudDsgbGluZS1oZWlnaHQ6MS42ZW07fQ0KCTwvc3R5bGU-DQo8IVtlbmRpZl0tLT4NCgk8dGFibGUgc3R5bGU9InBhZGRpbmc6MTBweDsgd2lkdGg6YXV0bzsgbWFyZ2luOjAgMTAlIj4NCiAgICAJPHRyPg0KCQkJPHRkPg0KCQkJCQk8cCBzdHlsZT0idGV4dC1hbGlnbjpjZW50ZXI7Ij4NCgkJCQkJPGltZyBzcmM9ImNp.........

Open in new window


Has anyone had experience extracting data from the body or can offer any suggestions on how I can convert the data field into someting rreadable

Thanks
0
Hello all,
our HTTP packets go via a proxy, unlike the rest of the TCP/IP packets.
so using ping to measure the latency between us and a webserver won't be very accurate. we need to measure latency over HTTP instead of ICMP.
any help ?
0
I have the below code that is returning undefined. How to rewrite so it uses a promise or similar mechanism to ensure addTSRecord returns the id to TimesheetRecords?

TimesheetRecords[i].id = addTSRecord(TimesheetRecords[i].RowID, moment(myWE).subtract(6, 'd').toISOString(), TimesheetRecords[i].TSStaffId, TimesheetRecords[i].Hours, TimesheetRecords[i].TSTaskId);						

function addTSRecord(myRow, myDate, myTSStaffID, myHours, myTSTaskID) {

		var endpointUrl = mySite + "/_api/web/lists/getbytitle('timesheets')/items";
		
		call;

		var call = $.ajax({
    		url: endpointUrl,
    		type: "POST",
    		data: JSON.stringify({
    			"__metadata": { type: "SP.Data.TimesheetsListItem" },
    			RowID: myRow,
    			TSDate: myDate,
    			TSStaffId: myTSStaffID,
			Hours: myHours,
			TSTaskId: myTSTaskID
	        }),
    		headers: {
    			Accept: "application/json;odata=verbose",
    			"Content-Type": "application/json;odata=verbose",
    			"X-RequestDigest": myFormDigest
    		}
		});

		call.done(function (data, textStatus, jqXHR) {
			return data.d.Id;
		});

		call.fail(function (jqXHR, textStatus, errorThrown) {
    		var response = JSON.parse(jqXHR.responseText);
    		var message = response ? response.error.message.value : textStatus;
    		console.log(message);
		 });
		
	}	//	addTSRecord

Open in new window

0
I have a requirement to use one controller that accepts two posts.
I receive the following exception "Multiple actions were found that match the request"

I realize this not ideal and it would make sense to just have a second controller. However, that is not an option. How can I complete this?
0
Searching for the user ID (integer) in Zendesk... test user has actual  id=22335667888 but the command I send to search for her returns id=2.2335667888E10

What is the best way to sanely convert that back? Can I always just remove the . and the E10?
0
Hello,
My questions are not being posted?
Administrator; Why?
It appears that this question got posted, so I will actually ask a question.
I have an external monitor hooked up to my laptop.  I have the font setting on the monitor set.
When I open Ready API! 1.9.0 the fonts are very tiny and I do not find where or how to change the size.
I do not want to change the size or resolution of the monitor.
Thanks
0
Increase Agility with Enabled Toolchains
Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Hello all,

What is the best way where I can hit a Rest Service URL I define where I would dynamically through a for container somehow pass an ID as the last part of the URL http://myserver.app/id/40 and as I loop through if I don't return a response for one of the calls I need to set a variable as error.

Thanks all
0
I am new to SQL Server but have been using MS Access for over 10 years.  This is my first application with a SQL backend and I want to take advantage of the SQL abilities, in this case Stored Procedures.

In my front end Access 2013 application I have payment inquiry screen.  At the top of the screen are possible filters, Muni (Long), LB (String), Payee(String), From Pay Date(ShortDate), Thru Pay Date(ShortDate).

The user must complete at least one of the filters then press the ‘Apply Filter ‘ button.  In prior application I have written, I then construct a Select statement based on the filters filled and use the constructed select as the recordset of the form  If multiple filters are selected the individual field selections are combined with an ‘Add’.  Here’s some example Access code to build a ‘Where’ condition behind one of these forms.
anyFilter = False
strFilter = " Where "
'
' Build filter
'
' Muni
If Nz(Me.txtMuni_Filter, 0) = 0 Then
Else
    If anyFilter Then
        strFilter = strFilter & " And [Muni] = " & Me.txtMuni_Filter
    Else
        anyFilter = True
        strFilter = strFilter & " [Muni] = " & Me.txtMuni_Filter
    End If
End If
' Lot Block
If Len(Trim(Nz(Me.txtLotBlock_Filter, ""))) = 0 Then
Else
    If anyFilter Then
        strFilter = strFilter & " And [LotBlock] Like " & Chr(34) & "%" & Trim(txtLotBlock_Filter) & "%" & Chr(34)
    Else
        anyFilter = True
        strFilter = strFilter & " [LotBlock] Like " & Chr(34) & "%" & 

Open in new window

0
I have a site with a NSA 240 and a TZ 200. The NSA has 12 VPN site to sites and the TZ has four. One of the tunnels stopped working and I have not been able to bring it back up. I have tried several types of configurations. The rest of the tunnels are ok. I deleted the vpn and reconfigured it again. This is what I get on the log. Since it was working before and I haven't make any changes I'm a little stumped.

 
19:37:25 Apr 26 406 Received packet retransmission. Drop duplicate packet 108.234.180.xxx, 500 192.168.1.64, 500 udp VPN Policy: M-
ain SY  
19:37:16 Apr 26 38 ICMP packet dropped due to Policy 108.234.180.xxx, X1 192.168.1.64 icmp  


Any ideas?
0
I'm trying to send a json string param to a post rest webapi method

Any assistance much appreciated


this doesn't work

var report = 2;
    var parameters = "{'report':'" + report + "'}";
   
    implementationworkqueueTable = $("#implementationworkqueueTable").DataTable({
        dom: 'Blfrtip',
        oSearch: { "bRegex": false, "bSmart": true },
        deferRender: true,
        bFilter: true,
        bSearchable: true,
        bProcessing: true,
        bRetrieve: true,
        bSortable: true,
        lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
        stripeClasses: [],
        ajax: {
            "url": "api/InfoHedge/IRequest",
            "async": true,
            "data": parameters,
            "dataSrc": function (json) {
                var data = JSON.parse(json);
                alert(json);
            },
            "datatype": "json",
            "contenttype": "application/json; charset=utf-8",
            "type": "POST"
        }
    });

Open in new window


This works

var report = 2;
    var parameters = "{'report':'" + report + "'}";

    $.ajax({
        type: "POST",
        async: true,
        url: "api/InfoHedge/IRequest",
        data: parameters,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (result) {
            var data = JSON.parse(result);

            var test = JSON.stringify(data.Table);
            alert(test);
            //alert(result);
        }
    });

Open in new window

0
I am making a REST call with a filter.  I know that there is a field names Status with 26 items has Status = Completed.  When my filter looks like this"
$filter=Status eq 'Completed'  
I get back 26 items.

The list has 60 items total.

When my filter looks like this:
$filter=Status neq 'Completed'
I get nothing back.

Please advise.
0
I have an Outlook (2010) Macro that sends emails with certain keywords in them to the "Deleted Items" bin.  What I would like now is an Outlook macro that will move emails having certain key words (account, ssn, credit) to another folder and the rest to the "Deleted Items" bin. All these emails come from a defined account.

see the code that I am using right now.

Function UnwantedMessage(olkMsg As Outlook.MailItem) As Boolean
    'On the next line edit the keywords/phrases you want to filter out.  Use the | character to separate each word/phrase
    Const KEYWORDS = "Address change completed|Thank you for your interest in employment |Ad|Internet Explorer 8 Settings"
    Dim olkAtt As Outlook.Attachment, objRegEx As Object, colMatches As Object
    Set objRegEx = CreateObject("VBscript.RegExp")
    With objRegEx
        .IgnoreCase = False
        .Pattern = KEYWORDS
        .Global = True
    End With
    For Each olkAtt In olkMsg.Attachments
        If IsHiddenAttachment(olkAtt) Then
            Set colMatches = objRegEx.Execute(olkAtt.FileName)
            If colMatches.Count > 0 Then
                UnwantedMessage = True
                Exit For
            End If
        End If
    Next
    Set olkAtt = Nothing
    Set objRegEx = Nothing
    Set colMatches = Nothing
End Function

Open in new window

0
input maybe, "Primary","Spouse","Chidren","Chidren"
input mabye, "Primary","Spouse","Chilren"
(The input came from asp.net checkboxlist so it is dynamics)

Output maybe
Primary
Spouse
Primry+Spouse
Primary+Child (should occur when only one children is occurred)
Priamry+Chidren
Family

DtFamilyCombination's goal is to return one record/row only
Below is work, but I do not want how to continue for the rest of situations.
Please helps.


private DataTable DtFamilyCombination(Array selectedList)
        {
            DataTable dt = new DataTable();
            dt.Clear();
            dt.Columns.Add("Type", typeof(string));
            foreach (var item in selectedList)
            {
                string str = item.ToString();
                if(str=="Primary")
                {
                    dt.Rows.Add(str);
                    break;
                }               
            }
            return dt;
        }

Open in new window

0
I have a combo box that I would like to limit its records 1-167, however it shows all 538 records, is there a way to limit this?
0
Hello Experts,

I want to write exportable react component which will be import in other react web application. This component could consume external rest api

Anybody have working example would be appreciated.

Thanks in advance
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I have built a few crude rest apis that return json response. One api accepts POST request and is used to login a user, and another accepts GET request and reads contents for user from database.

If the login occurs successfully, a $_SESSION["uid"] variable is set for checking if the GET response occurs from the same user. Basically, the login api returns a userid from the users database that is stored in the $_SESSION["uid"] variable. The GET request to read contents, gets this userid as a parameter, and if the server finds that the userid received from this request and $_SESSION["uid"] match then the contents are returned.

When I test the two codes using postman, the GET request returns the desired response, however, when I test the same on the browser (logging in manually from the site interface as the login occurs from a POST request) and then request the GET service from the address bar, it returns error message of not having any userid set (I put the error message in the return json to check if(isset($_SESSION["uid"])) is true else return error message).
Following are the codes:

[Login-POST]
   
<?php
        session_start();
        include_once $_SERVER['DOCUMENT_ROOT'].'/settings/ReadIni.php';
        include_once $_SERVER['DOCUMENT_ROOT'].getinivalue('Paths', 'database_connect_location');
        
        if( $_SERVER['REQUEST_METHOD'] == "POST" ) {
            if( $dberror == "" ) {
                if(isset($_SESSION["uid"])) {
                    

Open in new window

0
Hi

The UK office and the rest of the world have a WordPress multi-site instance they share.

The Australia and New Zealand Offices want to share there own separate WordPress multi-site but they want to integrate their blog with the UK and rest of the world site.

I would like a point in the right direction for the best way to achieve this any recommendations are welcome and much appreciated.
0
Hi

My goal is to retrieve all scheduled meetings in the calendars of our users where the location is set to one of our meeting rooms by a third-party tool. I want to then forward these meetings to the corresponding room mailboxes in O365.

I have been looking at EWS in combination with PS but it looks like using the O365 API's would even be a better approach. I would like to use PS to write a script that does the above.

Can anyone get me started please?

Thanks in advance!
0
I am getting back an object from a rest call which contains results from a SharePoint REST call.  The returned data has dups (which are indeed in the list).

I want to dedup the data and then return it to be used elsewhere.  It looks something like the following:

function DedupeList(flist) {
                var listlength = flist.length;
                var newObject=[];
                var currentID = flist.results[0].FID;
                newObject.push(flist.results[0])
                //
                for (var ptr=1; ptr<listlength; ptr++) {
                                if (flist.results[ptr].FID!=currentID) {
                                                newObject.push(flist.results[ptr]);
                                                currentID = flist.results[ptr].FID;
                                }
                }
                
                return newFilmsObject;                
}

Open in new window


The issue is I want to return an object like the passed in data set from the REST call and am not sure if the array I am using to build the deduped set will work.
0
how can I check the domain admin password will impact on the SQL server and its services  ?  do we have to check the services one by one or is there any place where i can cross check the windows setting in the sql server  .  i am trying to change the domain admin password ? so that need to get the confirmation that want affect the SQL and the rest .

when I am trying to login to the sql server has two options windows or SQL  . if i select the windows it doesn't ask the password and going to the SQL  . if i change the password , I hope it will take the changes automatically .

do I have to take any  best practice at the time of changing the domain password ?
0
Hi how to consume htttps service in asp.net using c#
0

REST

155

Solutions

1

Articles & Videos

314

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.