REST

265

Solutions

528

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 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
Cloud Class® Course: CompTIA Cloud+
LVL 12
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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
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
Cloud Class® Course: Microsoft Office 2010
LVL 12
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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
So I have a block of static ip addresses, im currently using one with my peplink router and I have the rest attached to a switch so I can use them for other applications that need public IP's. From within my lan behind the peplink router I cannot get to one of the public ip's I have attached to a device that is sitting on the public ip side of things on that switch.. I can ping it from with in my lan but I cannot access it. My guess there is a port that is being blocked? 443 is the service port and https is turned on. Any tip or trick on what exectly I need to fwd in my peplink router would be greatly appreciated..
0
I currently upload finish line pictures from races I time to Google + and share the gallery with race finishers so they can find their picture.  I would like to take that a step further and share each finishers individual picture with them.  I believe Google Vision has the technology to do that...albeit for a cost...by pairing participant bib number with bib in the image.  Is anyone familiar enough with this api to give me some direction as to how to do this?  Also, any idea how this product is priced?
0
Downloaded a Sample App.  I am using VS2015.  The app doesn't compile.  I am receiving what seems to be a REST error.

CS1503      Argument 2: cannot convert from 'System.Action<System.IO.Stream>' to 'byte[]'      Tradovate.Services      

The error is occurring at

                request.AddFile(param.Value.Name.ToString(), param.Value.Writer,
                                param.Value.FileName.ToString(), param.Value.ContentType.ToString());

In the below code.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.IO;
using System.Web;
using System.Linq;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using RestSharp;

namespace Tradovate.Services.Client
{
    /// <summary>
    /// API client is mainly responsible for making the HTTP call to the API backend.
    /// </summary>
    public partial class ApiClient
    {
        private JsonSerializerSettings serializerSettings = new JsonSerializerSettings
        {
            ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
        };

        /// <summary>
        /// Allows for extending request processing for <see cref="ApiClient"/> generated code.
        /// </summary>
        /// <param name="request">The RestSharp request object</param>
        partial void InterceptRequest(IRestRequest request);

        /// <summary>
        /// Allows for extending response processing for <see

Open in new window

0
windows 7 pro loads 31 processes and sits at black screen for 4 minutes to load the rest.

Only the cursor arrow shows. Partition reimaged with known good acronis tib and gets same result. GUI takes LOOOOONG time to load.
New Samsung 860 top 'o the line ssd appears okay/
0
I have installed a copy of Magento 2 locally on my computer and what I want to do is to set it up so that I can access the whole thing as a Rest Api.

I have tried some url's like: http://127.0.0.1/magento/rest/v1/products but I don't get any json.

How can I set this up so I can access the api from my browser url?
0
Get your problem seen by more experts
LVL 12
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Hi all,
I have following powershell script that I use to re-order column, its actually works pretty fine and fast.  There is  few changes that I need to work on this scripts.

1: How do I introduce new column in output file although existing file did not have those column ? I need to add two more column between $data[4], $data[7], $data[6], I also need to add column name header in this new column  since the rest of the column has column header.




$ImportFile="DWH_Import_File.csv"
$ImportDate = (Get-Date).AddDays(-1).ToString('yyyy-MM-dd')
$DWHFile = "DWH_Import_File_$ImportDate"
$DWHFile1 ="$ImportFile-Convert.csv"
$Import = [System.IO.File]::OpenText("F:\DWH\HRISEMP\$ImportFile")
$DWHdata = New-Object System.IO.StreamWriter "F:\DWH\HRISEMP\Tool\$DWHFile1"
for(;;) {
    $line = $Import.ReadLine()
    if ($null -eq $line) {
        break
    }
    $data = $line.Split(",")
    $DWHdata.WriteLine('{0},{1},{2},{3},{4},{5},{6},{7},{8}', $data[0], $data[8], $data[5], $data[4], $data[7], $data[6], $data[2], $data[1], $data[3])
}

$Import.Close()
$DWHdata.Close()

Open in new window

0
Hi Experts,
I have written a small application that is linked to Excel files, reads two spreadsheets and does some comparisons.
Those sheets contain SS numbers.
Now I see that some socials are aligned to the right side and some to the left side.
And the problem is that Access only reads the first set of socials, the rest are showing as error.
Since user gets those files from a third party software, no way to figure out why they're like this..
How can I overcome this issue?
0
I have been asked to stand up a weighted search appliance for a company.  The decision was to use SOLR to create the search tool so they can use the associated REST API for searches and recommendations.

I'm am still beginning in SOLR and have to ask a basic architecture question.  I have a table with 220 elements, 130 Million record strong.  I grow 5 million a year.

Does this become a Hadoop solution?  or can this still be done with a single SOLR engine?  I need to know which direction to start with so I do this right

Thanks much.
0
I have an HP EliteBook laptop that was getting a new image. This is a G2 laptop. Anyway I started the laptop image in the Microsoft System Center\software center. Selected the name-G2 - ME firmware - install bios - and googleDriveSync. I then selected and downloaded the ME updater. The firmware finished. Then in the bios I selected fast boot, PXE internal nic, PXE internal IPV4 nic, and under secure boot config I selected UEFI native without CSM then under device settings checked the box that said SATA device mode set to AHCI, VTx is checked  and G2 only then saved it. Then the user grabbed it before I could start the rest as I had to make a call to another user. She took the laptop and now it will not boot to any OS and goes to shut down mode. I was told that this would make a brick out of the laptop? Is there no way to get this laptop back to factory settings without a new motherboard being needed? This is really my question.
0
Dear experts,

I have purchased a new touchscreen laptop HP Pavilion.

While working on the notepad I have seen that the screen moves upwards without me scrolling. What i mean is I observe this scrolling when I rest my wrist and palm on the screen to begin writing.

How do I ensure it does not scroll involuntarily. Can i lock it?

In the attached video I have simulated my experience through voluntary scrolling. My issue is it scrolls when i just rest my palm and when there is no scrolling.

Kindly guide.

Thank you
WhatsApp-Video-2018-04-13-at-05.54.1.mp4
0
Is there a way to search for e-mails / calendar items with a specific word in it like "registered" and remove that line only and keep the rest of the subject
Exchange / Office365
Example : [REGISTERED] - Realsubject
Remove the [REGISTERED] and keep Realsubject

Thanks in advance!
0

REST

265

Solutions

528

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.

Top Experts In
REST
<
Monthly
>