[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

REST

279

Solutions

556

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 Sirs
I am using serious issues with Charset Encoding in a REST application. I use Spring and the encoding in the bean MessageSource and Tymeleaf resolver  is set to UTF-8.
I get this when I return Json string:
\ufffd replacing special characters like é, or any other letter with accent.
How can I solve this?

Best regards.
0
Rowby Goren Makes an Impact on Screen and Online
LVL 12
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.

My gaming laptop, an Asus G551JM is having some weird boot issues.

It used to have a hybrid drive, and after the drive broke I bought a new Kingston UV500 960GB SSD for it.
After installing Windows 10 on it I quickly noticed that the boot times were... odd.

Sometimes a boot lasts 2 minutes, sometimes around 40 seconds.
I ran a boot cycle test with Windows Performance Recorder.
The pre-session init phase seems to take around 30 seconds, the rest very little.
It just feels like something is stalling... and once it times out the computer then boots really fast.

https://imgur.com/EWE53EU

I'm new to the program, so I admittedly don't really understand them well.
Perhaps some of you are familiar with them?

This is my personal computer, so I feel it's fine for me to share the log files:
https://files.fm/u/nt4cjcau

I've also ran a few disk check programs and all of them have reported that the disk is in excellent condition.
It moves files fast and seems to work great in actual use.

Also, oddly, the computer would restart whenever it was trying to recover from sleep mode... but I kind of fixed it.
I read that some Asus laptops with sleep mode issues start working if you re-flash them with the same BIOS it already has, using WinFlash.
I gave it a shot! ...and now instead of rebooting from sleep mode, it actually recovers. ...very slowly (1 min 30 sec or so)
(Re-flashed from the already newest version... I have NO idea why that changed anything!)

I've …
0
Hello, Experts!

Environment:

Windows Server 2016
IIS version 8
the site lives in c:\inetpub\sales.cbac.com
ports are http 80 and https 443

Issue:

What might be causing the issue of receiving data from a REST call using angular hosted on IIS 8 (see image attached)? I want to start a dialogue so you guys can ask more questions and I could provide more narrowed answers.
image--8-.png
0
Hi Guys

I am needing to trash the contents of a 60+ Gig mailbox on our exchange 2010 environment.
I was looking at the below script and tested it on another mailbox and it works like a charm.

Search-Mailbox -Identity "Peter Pan" -DeleteContent

But as always the scope gets changed on min 99 and now the request is to delete all mail except 1 months (Latest mail) worth of mail in the mailbox.
Now I am not a guru on PowerShell, but surely there should be something I can add to my current command that will leave 1 months worth of latest mail and trash the rest?
Any  assistance win this would be appreciated.

Regards
R
0
Hi Expert,

When i'm selecting data from external table getting following error , i want to capture all the error into a log for the error visibility.

ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-05002: There are no matching files for any file specification in the LOCATION clause.

--I'm using below pkg for creating message for user

o_error_message := SQL_LIB.CREATE_MSG ('PACKAGE_ERROR',
                                             'ERROR:'|| L_mark || '|' || sqlerrm,
                                              L_program,
                                              to_char (sqlcode));
      ROLLBACK;
--Here the pkg only print the ORA -Error , Here i'm looking for both "ORA" and "KUP" error.

Open in new window


But now only 1st line "' ORA-29913: error in executing ODCIEXTTABLEOPEN callout"  got printed in output. rest of lines are skipped.

Please share the solution for this.

Thanks in Advance!
0
My website has recently gotten a new IP-address (shared host), but though the rest of the world can see it, I cannot, even after 48 hours. I have flushed my DNS, but to no avail. The problem comes in all browsers. Flushed my cache as well, but the problem remains.

While trying I also found that I cannot start the power shell either normally or as admin. Nothing happens when I click on them (The command prompt itself comes up outside the power menu). I have added this key: Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
"InstallRoot"="C:\\Windows\\Microsoft.NET\\Framework64\\"
but again no use. I am on W10
0
I am setting up an Office 365 Business Essentials package for a small business.  They are currently using G Suite.  I had planned to move a user over to test that everything was working the way it should be adding all of the rest of the users.  If I make the DNS entries in G Suite, is that going to apply to every user or how can I simply migrate one account and modify one account at a time to ensure a smoother transition and not having everyone freaking out about the transition at once?
0
Hello Experts,

I was writing a restful apis
I would like to have a snippet of code to  which will handle the exception like
If request was successful, then return 2xx code (3xx for redirect).
 If there was an internal logic error on a server, then return 5xx. If there is anything wrong in client request, then return 4xx code.
 like to have a user friendly description of the errors...

Thanks
0
Hi,

I've a question in relation to setting up VLANs.  I need to add another subnet to my network, I would like to separate out our HR dept (to begin with, the others will follow) and to free up some IP addresses on our existing Subnet.  I have four switches, two are Cisco SG 200-50, the other is a Cisco Catalyst 2960-X and the last one is a Catalyst 3560-CG.  I also have an MPLS router with our third party company to connect to the rest of our sites.  I've created a number of VLANs on the 3560, one for our HR Dept, one for management and a few others that I'll use later down the line.  My question is, how does it all fit together.  I'm aware the the 3560 will be carrying out the routing of the VLANs but should I have trunk links between all the switches (the HR folk will be connected via the 2960)?  Should the 3560 be direcly connected to the MPLS router, if not and I plug it directly into another swithc, surely that would create a loop.  I have the basics down (I think), I've created the VLANs, setup their interface IPs, enabled the 3560 for routing and not i'm stuck on the trunks and how it should all fit together.

Cheers all for any help
0
hi all,

Any known problem on  MariaDB to work with MySQL Enterprise and MySQL community?

what need to setup so that they all work together well ?

we are considering to save cost on, e.g. only some of them are MySQL Enterprise and the rest are MySQL community/MariaDB.

any idea?
0
Become a Microsoft Certified Solutions Expert
LVL 12
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

i am trying to print a form which has textboxes and data gridveiw  using Printdocument control, the code below will print the text boxes and first cell of grid view , for the rest of the cells i am getting following  error :
An unhandled exception of type 'System.NullReferenceException' occurred in System.Windows.Forms.dll
Object reference not set to an instance of an object.

 
 private void btnPrint_Click(object sender, EventArgs e)
        {
            printPreviewDialog1.Document = printDocument1;
            printPreviewDialog1.ShowDialog();
        }
e.Graphics.DrawString("Date: "+DateTime.Now.ToShortDateString(),new Font("Arial",12,FontStyle.Bold),Brushes.Black,new Point(20,95));
            e.Graphics.DrawString("Report Number" + txtReportNumber.Text, new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(20, 150));
            e.Graphics.DrawString(@"------------------------------------------------------------------------------------------------------------------------------------------------------",
            new Font("Arial",12,FontStyle.Bold),Brushes.Black,new Point(20,170));
            e.Graphics.DrawString("SN", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(65, 185));
            e.Graphics.DrawString("Reference", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(180, 185));
            e.Graphics.DrawString("Amount", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, new Point(480, 185));
 

Open in new window

0
I have a PHP REST API, built from this tutorial:
http://www.tutorialsface.com/2016/02/simple-php-mysql-rest-api-sample-example-tutorial/

I need to do these steps in one function and am not sure how to accomplish it.

1. Accept XML Request
2. Respond to request with XML response and 200 status code
3. Send another XML response and 200 status code to a URL parsed from the XML Request


Currently. I have it like this:
function ProAddRq() {

    // If this isn't a POST, respond with 405...
    if($this->get_request_method() != "POST"){
        $this->response('Error code 405, Method not allowed.',405);
    }

    // Get the XML request from input
    $request = file_get_contents("php://input");

    // Get the RqUID from the request
    $xml = @simplexml_load_string($request);               
    $RUID = strtolower($this->xml->xpath("//ProAddRq/RUID")[0]);

    // Build the ACK message CML from the template
    $ack_data = array();
    $ack_data["RUID"] = $RUID;
    $ack_data["PKey"] = "2b3420be-69bf-4bb7-43bb-b632947e236b";
    $ack_data["Status"] = "Accept";

    // using PHP Mustache to render the XML with the values
    $xml_post_string = $this->m->render('../../views/ack' , $ack_data);

    // Call the SendInventory function to send to the URL that is parsed from the $request
    $this->SendInventory($request);

    // set the content_type
    $this->_content_type = 'application/xml';

    // respond with the ACK and 200 response...
    // Setting 

Open in new window

0
I've been successfully experimenting with interfacing with WordPress's REST API using React.  I've enabled CORS for the remote WordPress site (by modifying it's .htaccess file), and I've succeeded at consuming the JSON data from the API and displaying it by rendering it in my App.js file.  

The code for my App.js file is as follows:

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

import { 
  BrowserRouter,
  Switch, 
  Route
} from 'react-router-dom';

import Home from './components/Home';
import Accounts from './components/Accounts';

class App extends Component {

  constructor() {
    super();
    this.state = {
      accounts: []
    }
  }

componentDidMount() {
  let accountsURL = 'https://mywordpresssite.com/wp-json/wp/v2/posts';
  fetch(accountsURL)
  .then(response => response.json())
  .then(response => {
    this.setState({
      accounts: response
    })
  })
}

  render() {

    let accounts = this.state.accounts.map((account, index) => {

    return (    
        <div key={index}>
          <p>{account.title.rendered}</p>
          <hr/>
        </div>   
      )
    });      

    return (
      <div className="App">

        <header className="App-header">
          <br />
          <img src={logo} className="App-logo" alt="logo" />
        </header>

        <br />     

        {accounts}

        <div className="row">
          <BrowserRouter>
            <Switch>
              <Route path="/" exact 

Open in new window

0
Hello Experts,
Just wanted to find out how do you guys dynamically update the Office 365 endpoints IPs and URLs that are published by MS for the proxy and firewall access? I know the RSS feed will be retired soon per what I read online and do you guys just run a PS script that grabs the info from the published XML file or there's a better solution/idea out there? Any input would be greatly appreciated!
0
Hi All,

I'm calling the code below.  

  using (Stream stream = request.GetRequestStream()) throws an error the first time but when I call authenticate again from within the catch it works.  

Postman using the same variables works first time.  I've engaged the hosting company but trying to determine if there's an issue on my side or a reason why it would fail the first time from my code.

Thanks in advanced for the help.



  private static Authenticate Authenticate(bool secondTry=false)
        {
            string url = Config.URL + "token";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.KeepAlive = false;
            request.Headers.Add("Authorization", "Basic " + Utility.Base64Encode(string.Format("{0}:{1}", Config.ConsumerKey, Config.SecretKey)));
            
            request.Method = "POST";

            //what I'm sending to the web request on a post.
            string postData = "grant_type=STUFF";
            
            Byte[] data = Encoding.UTF8.GetBytes(postData);
            request.ContentLength = data.Length;
            
                        
            // default settings.
            request.Accept = "application/json";
            request.ContentType = "application/x-www-form-urlencoded";

          
            AttachClientCert(ref request);  // Attaches PFX to request
            setTLS();  //set TLS to 1.2 and other ServiceManager configs.

            try
            {
    

Open in new window

0
Lets say you have the following REST Service.

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
	xmlns:xe="http://www.ibm.com/xsp/coreex">
	
	(JSON) - View Column - Checkbook
	<xp:br></xp:br>
	<xe:restService id="restService1" pathInfo="GetViewCheckbook">
		<xe:this.service>
			<xe:viewJsonService viewName="VIEWCheckbook" systemColumns="0" defaultColumns="true" compact="true" count="1000"/>
			</xe:viewJsonService>
		</xe:this.service>
	</xe:restService>
</xp:view>

Open in new window


Am I able to access the user name of the logged in user who made the service call?
0
Is it possible to set different clicks in differten terminal sessions.
We have 1 TS with 30 users. 6 of them are in abudhabi, 2 in malaysia. and the rest in the netherlands.
Is it possible to configure session based clocks in Windows Server 2012 R2?
0
I have created an Xpage custom Rest Service to retrieve a JSON value field from a document.

I take that field value and add other JSON values to a string variable (strJSON).

How can I validate the string variable contains valid JSON?

I receive an error ("'JSON' not found") with the following regardless if the string contains valid JSON:
JSON.parse(strJSON)
0
First and foremost, I am new to xpages.

I have a xpage REST Service that consumes a View Name URL parameter so I can have one service to retrieve any supplied view name.

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
	xmlns:xe="http://www.ibm.com/xsp/coreex">
	
	(JSON) - View Column - Pass View Name
	<xp:br></xp:br>
	<xe:restService id="restService1" pathInfo="GetViewColumns">
		<xe:this.service>
			<xe:viewJsonService systemColumns="0" defaultColumns="true" compact="true" count="1000">
				<xe:this.viewName><![CDATA[#{javascript:param.get("ViewName");}]]></xe:this.viewName>
			</xe:viewJsonService>
		</xe:this.service>
	</xe:restService>
</xp:view>

Open in new window


I receive the following response if the view name provided does not exist:

{
    "code": 400,
    "text": "Bad Request",
    "message": "Unknown view VIEWNAME in database Sample.nsf",
    "type": "text",
    "data": "com.ibm.domino.services.ServiceException: BLAH BLAH BLAH"
}

Open in new window


Can I redesign the service so I can control the error response?

Thanks in advance.
0
Exploring SQL Server 2016: Fundamentals
LVL 12
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

MS windows Server NLB services running Cannot ping or telnet mail Server's Virtual IP configured on F5 LTM  neither could telnet on port 25

netstat -ano shows that 10.4.60.182:25 waiting on status Sync_sent (screenshot attached)

Interestingly as soon as i start packet capture on wireshark ping and telnet starts to work

I feel that there is some discrepancy in the  IP or the MAC address  in the communication happenign between f5 and MS windows server (screen shot attached)

As I said MS windows are running NLB services  for web application running, So its NLB VIrtual IP is basically having all the ARP associated to it , screen shot attached

MS server IP 10.4.60.131
MS NLB IP  10.4.60.130

F5 Virtual IP 10.4.60.182
F5 Floating IP  10.4.60.218

Note: MS NLB Can ping and telnet to MS Exchange  CAS IP successfully,  only  failing with F5 however rest of the Servers/ smarthost can commnicate with F5 successfully
0
Hi All,
I'm working in VB6 (just to set the view).
I'm creating an ActiveX Dll.
I have an OCX which has various events.  The OCX needs to be on a form for it to do anything.
I have a class which isolates the OCX from the rest of the world - all of the OCX properties are supplied by passing through the class
So far, this all works ok.
Where I'm running into problems is trying to get the events from the OCX out of the DLL to be used by the main program.
I have looked and have not been able to find anything.  There are lots of examples showing the WithEvents, but none from a DLL.
Maybe what I want to do isn't possible.
0
One of our clients has exchange 2010 and one user has a huge mailbox (currently about 65GB) so has to work in non-cached mode rather than cached mode.  His OST file just stopped working at 50GB. The user is complaining that searches are not returning all the results it should. Since he is using online mode, I assumed that all the indexing was being done by exchange server and rebuilt the index for the database he was using. (He and one other person share a whole exchange database, the rest of the company is on a different database.) He is still complaining that the search is not returning all the results. I know that when you are in cached mode, the email is indexed by Windows indexing, but what happens in non-cached mode?
0
I am using the following code which sends an email from excel to outlook
Sub Send_Email_Late()

    Dim rng As Range
    Dim OutApp As Object
    Dim OutMail As Object
    Dim Name_Lookup As String
    
  




    

    Set rng = Nothing
    Name_Lookup = ActiveSheet.Range("A3").Value
    
    
    On Error Resume Next
    'Only the visible cells in the selection
    'Set rng = Sheets("Sheet 1").Range("B2:B22").SpecialCells(xlCellTypeVisible)'
    'You can also use a fixed range if you want
    Set rng = Sheets("Stationary").Range("B1:O8").SpecialCells(xlCellTypeVisible)  ':B11
    On Error GoTo 0

    If rng Is Nothing Then
        MsgBox "The selection is not a range or the sheet is protected" & _
               vbNewLine & "please correct and try again.", vbOKOnly
        Exit Sub
    End If

    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With

    
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
        '.SentOnBehalfOfName = "sales@matthewclark.co.uk"
        .To = ActiveSheet.Range("Cs4").Value
        '.CC = Sheets("Email Data").Range("K2").Value'
        .BCC = ""
        .Subject = "Lateness Email - ENTER DATE"
        .HTMLBody = Name_Lookup & RangetoHTML(rng)
        .Display  'or use .Display
    End With
    On Error GoTo 0

    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With
'    MsgBox

Open in new window

0
Hi Experts,
I have the following code which loops thru all records of a given table (on Caspio site) and prints out the contents.
Function GetDataFromCASPIO1()
    Dim objHTTP As New WinHttp.WinHttpRequest
    Dim docXML As MSXML2.DOMDocument
    Dim ResponseText As String
    Dim curNode As IXMLDOMNode
    Dim oNodeList As IXMLDOMSelection

    Set docXML = New MSXML2.DOMDocument

    Set objHTTP = New WinHttp.WinHttpRequest
    URL = "https://abc123.caspio.com/oauth/token"
    
    objHTTP.Open "POST", URL, False
    objHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"

    objHTTP.Send "grant_type=client_credentials&client_id=MyClientID&client_secret=MySecretID"
    ResponseText = Right(objHTTP.ResponseText, Len(objHTTP.ResponseText) - 17)
    access_token = Left(ResponseText, InStr(ResponseText, """") - 1)
    'Debug.Print access_token


    Set objHTTP = New WinHttp.WinHttpRequest
    'objHTTP.setRequestHeader "Content-Type", "application/json"
    URL = "https://abc123.caspio.com/rest/v1/tables/Caregivers/rows"
    objHTTP.Open "GET", URL, False
    objHTTP.SetRequestHeader "Accept", "application/xml"
    objHTTP.SetRequestHeader "Content-Type", "application/json"
    objHTTP.SetRequestHeader "Authorization", "Bearer " + access_token
    objHTTP.Send
    'Debug.Print objHTTP.Status
    'Debug.Print objHTTP.ResponseText
    docXML.loadXML (objHTTP.ResponseText)

    strXPathQuery = "Caspio/Row"
    Set oNodeList = 

Open in new window

0
can anyone explain how to create REST API using PHP
0

REST

279

Solutions

556

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