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

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
Upgrade your Question Security!
LVL 12
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

How do I call a BI publisher report via an apex rest service.
Can you please share any examples / links
0
I am attempting to setup Rest API in VBA and need some help walking through the steps. Can anyone help me by walking me through step by step for that I can learn how to do this for future projects?
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
Can I replicate a search using the Google Maps API local search with  an iOS MKLocalSearchRequest() ?  For example, using the Google API, making a map search using the keyword "hostels" works correctly. In iOS using MKLocalSearchRequest(), using a naturalLanguageQuery, I just get hotels. Is there a way to fix this?  Or am i forced to use the Google Maps API within iOS?
0
I am trying to show error in Angular 6 but I am using it with query parameters. I am searching for the data using query parameters and if there is any invalid request, I want to show that error. But I am unable to do that. Below is my code

SearchComponent.ts

werbedataSearch(werbenr, produktname, werbetext, artnr, vk_einheit, hinweise) {
    this.router.navigate(['/rullko/werbedata/results/'],
        {
            queryParams:
                {
                    filiale: this.filiale,
                    werbenr: werbenr,
                    artnr: artnr,
                    produktname: produktname,
                    werbetext: werbetext,
                    vk_einheit: vk_einheit,
                    hinweise: hinweise
                }
        });
}

Open in new window

ResultsComponent.ts

ngOnInit(): void {
    this.route.queryParams.subscribe(params => {
      // Defaults to "" if no query param provided.
      this.filiale = params['filiale'] || '';
      this.werbenr = params['werbenr'] || '';
      this.produktname = params['produktname'] || '';
      this.werbetext = params['werbetext'] || '';
      this.artnr = params['artnr'] || '';
      this.vk_einheit = params['vk_einheit'] || '',
        this.hinweise = params['hinweise'] || '',
        this.page = '1' || '';
      this.pageSize = '10' || '';
    });
    this.getPage(1);
  }

Open in new window


service.ts
 getWerbeDataSearch(page: string, pageSize: string, filiale: string, werbenr: string, produktname: string,
    werbetext: string, artnr: string, hinweise: string, vk_einheit: string): Promise<WerbeData[]> {
    const Url = `${this.werbedataSearchUrl}`;
    const params: URLSearchParams = new URLSearchParams();
    params.set('page', page);
    params.set('pageSize', pageSize);
    params.set('filiale', filiale);
    params.set('werbenr', werbenr);
    params.set('produktname', produktname);
    params.set('werbetext', werbetext);
    params.set('artnr', artnr);
    params.set('hinweise', hinweise);
    params.set('vk_einheit', vk_einheit);

    return this.http.get(Url, { search: params, headers: this.headers })
      .toPromise()
      .then(this.extractData)
      .catch(this.handleError);
  }

Open in new window


In service, I am getting error (Requested werbedata does not exist) which i want to show.

Can someone please tell me how to do this?
0
getting api data from posts from another sources to django
hello guys ,

is there any way where

when users can add the link of the post they want to save and the django should add that post allong with description and image to database

eg:

https://www.reddit.com/r/memes/comments/91jdgp/everything_goes_back_to_spongebob/

if i want to save this post

then dango should get data from this post as a json format and should save this post image, description ,title and all to the database

i know this can only be done using api/praw

but cant understand how to make it happen

any kind of help is appreciated
0
I have a PayPal buy it now client side REST on my website. Payment process is working fine on my end, but the customer, after he pays, doesn't see the payment confirmation screen. I've read on PayPal Dev that I must show a confirmation without redirecting, which is something that I am doing now.


You must show a confirmation without redirecting the page. If you redirect the page, the actions.payment.execute() and actions.payment.get() functions are not available.

This is the code I am using:

payment.asp
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
</head>
<%
Dim price : price = "134.96"
%>
<body>
<div id="paypal-button-container"></div>
</body>
<input type="hidden" name="price" id="price" value="<%=price%>" />
<script src="payment.js"></script>  

Open in new window


payment.js
// JavaScript Document
paypal.Button.render({

env: 'sandbox', // sandbox | production

        style: {
        label: 'checkout',
        size:  'medium',    // small | medium | large | responsive
        shape: 'pill',     // pill | rect
        color: 'silver'      // gold | blue | silver | black
        },

        client: {
            sandbox:    'aaaaaaaaa',
            production: '<insert production client id>'
        },

        // Show the buyer a 'Pay Now' button in the checkout flow
        commit: true,

        // payment() is called when the button is clicked
        payment: function(data, actions) {

            

Open in new window

0
Hi,
I am working on a POC on KONG api gateway.
Steps followed :
1-  I have installed Kong enterprise edition using docker container. (successful)
2- I ran another spring boot sample docker container
3- configure a service in kong api gateway using admin rest api.
4- configured a route for the service
5- now trying to access the url http://localhost:8000/v1/api/orders, but getting error response "An invalid response was received from the upstream server" with 502 Http error code
When I checked the docker logs file for kong-ee container found the error " 19#0: *10273 connect() failed (111: Connection refused) while connecting to upstream"


Note: Inside Kong-ee container when I tried to access the upstream url using : curl -i -X GET http://127.18.0.1:8082/v1/api/orders it gives me connection refused, but when I tried to
ping 127.18.0.1(which is the ip of docker host machine) it gives me proper reply.
Need some urgent help on this issue.

Any help would be appreciated.
0
I got a requirement from the business that they want to use single user mailbox for 20 employee but they don't want to use shared mailbox.  now we are facing problem that only 6 outlook profile for the single mailbox are working at the same time and rest are not connecting. if we close any one of them than another outlook profile start working.Hence could anyone please let me know that how many outlook client can be connected for the single mailbox at the same time to the exchange server in exchange 2013 environment.
0
Introducing Cloud Class® training courses
LVL 12
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Hi All,

I'm developing an app that the user can see which of its contacts are registered for the app.
Say I have a data base of users in the cloud what should be the rest end point for such operation?
Should I send all of the user's contact to the endpoint and the server will make the set intersection between the input contact set the its all registered contacts?
But what if the user has many contacts?

Thank u in advance
0
Hi,

I have this json coming from an REST api. I now want to make a representaion of it in my asp.net site (I use vb.net for the moment). But I don't fully get it to work when I create the classes representing the json and deserialize it. This is how the json looks like when I copy it form Postman:
{
    "data": {
        "type": "vehicle",
        "attributes": {
            "regno": "HCA015",
            "vin": "WF0MXXGBWMDP17671"
        },
        "links": [
            {
                "rel": "self",
                "uri": "vehicle/vin/WF0MXXGBWMDP17671"
            },
            {
                "rel": "biluppgifter",
                "uri": "https://biluppgifter.se/fordon/HCA015"
            }
        ],
        "basic": {
            "data": {
                "make": "Ford",
                "model": "GALAXY 2.0 TDCi",
                "status": 2,
                "color": "Svart",
                "type": "PB",
                "vehicle_year": 2013,
                "model_year": 2013
            }
        },
        "inspection": {
            "data": {
                "latest_inspection": "2016-09-19T00:00:00+02:00",
                "inspection_valid_until": "2018-09-30T00:00:00+02:00",
                "meter": 38650,
                "next_inspection_range": [
                    "2018-05-01T00:00:00+02:00",
                    "2018-09-30T00:00:00+02:00"
                ]
            }
        },
        "status": {
            "data": {
                

Open in new window

0
I'm trying to use Rest assured and JsonPath to extract a value from the pzSetRuleSetFilter field where the pyRuleSetName equals a certain value (TradeMarks in this case). I keep getting the error below. Any ideas on how I can fix this and extract the value would be great

invalid JSON expression:Script1.groovy: 1: expecting EOF, found '[' @ line 1, column 39.

My Query System.out.println(response.jsonPath().getString("$..pxResults[?(@.pyRuleSetName == 'TradeMarks')].pzSetRuleSetFilter"));

See attachment for a screenshot of some of the Json response from SoapUI
Capture.PNG
0
I use FOS Rest Bundle with FOS user ton create registration form. The registration does not work so i tried to verify if there's an issue with my database.I've tried doctrine schema update and i receive a strange error .
[Doctrine\DBAL\Exception\DriverException]
  An exception occurred while executing 'CREATE TABLE `buyer` (id INT AUTO_INCREMENT NOT NULL, buyer_type_id INT DEFAULT NULL, country_id
   INT DEFAULT NULL, language_id INT DEFAULT NULL, first_market_region_id INT DEFAULT NULL, second_market_region_id INT DEFAULT NULL, thi
  rd_market_region_id INT DEFAULT NULL, creator_user_id INT DEFAULT NULL, modifier_user_id INT DEFAULT NULL, `name` VARCHAR(320) NOT NULL
  , `description` VARCHAR(1024) DEFAULT NULL, `main_products_services` VARCHAR(512) DEFAULT NULL, `reference_number` VARCHAR(100) DEFAULT
   NULL, `phone` VARCHAR(20) DEFAULT NULL, `fax` VARCHAR(20) DEFAULT NULL, `website` VARCHAR(100) DEFAULT NULL, `email` VARCHAR(255) DEFA
  ULT NULL, `first_name` VARCHAR(100) DEFAULT NULL, `last_name` VARCHAR(100) DEFAULT NULL, `job` VARCHAR(255) DEFAULT NULL, `picture` VAR
  CHAR(255) DEFAULT NULL, `address` VARCHAR(500) DEFAULT NULL, `zip_code` VARCHAR(10) DEFAULT NULL, `city` VARCHAR(10) DEFAULT NULL, `com
  pany_name` VARCHAR(320) DEFAULT NULL, `total_revenu` VARCHAR(100) DEFAULT NULL, `first_market_rate` INT DEFAULT NULL, `second_market_ra
  te` INT DEFAULT NULL, `third_market_rate` INT DEFAULT NULL, `is_public` TINYINT(1) NOT NULL, `views` INT DEFAULT NULL, …
0
Greetings,

I am using evaluation version of microstrategy, can you please let me know  how can I get table and columns of that table using REST API.
OR in generic term relation between objects.
0
In Powershell when I try to run Invoke-WebRequest -Uri http://DMS/admin/apps/478/0.0.2/Android -Method PUT -body $dms2

Invoke-WebRequest : Length Required
HTTP Error 411. The request must be chunked or have a content length.

my mission is to get some parameters in Invoke-WebReques Method Get , replace some variables and update specific line with Method PUT

my script:
$dms2=Invoke-WebRequest -Uri http://DMS/admin/apps/478/0.0.2/Android -Method Get
$dms2.Content.Split(',') | Select-String -Pattern "dictionary_url_rus"
$BB=$dms.tostring().Substring($dms.tostring().LastIndexOF("/") +1).trim('}','"')
$dms2.tostring() -replace $BB, "temp.json"

$dms=Invoke-WebRequest -Uri http://DMS/admin/apps/478/0.0.2/Android -Method PUT -body $dms2
0
Hi guys,
when submitting data to a rest api via curl from php i sometimes get this error but very rarely- like 1 in a 100 times. Why would this be?

Data submitted with response <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
0
Hi guys, i need to submit from my php code via curl to rest api. issue is they want me to submit with date and time stamp in following format: <DateSent>2018-04-26T15:12:36.9769394+02:00</DateSent>
I do have the format correct but i dont understand the part after the time "9769394" ? what could this be? doesnt look like mili seconds at all?
My date looks as follows when submiting : 2018-04-27T13:51:45+02:00 but server not accepting it
0
What is the best practice to log REST API response messages, these responses are too huge.
I am working on a requirement to log the responses to files
0
Get expert help—faster!
LVL 12
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

I have a rest api webservice which is going to return data in form of json doc. In my case it’s a object which I serialize via newtonsoft json. Works all fine but the json string I get in postman has all the escape slashes.  How can I get rid of those other then running a replace
0
I am trying to build a REST API in .NET and are running into some issues. My service will use JSON Data which is send to the Server in the Body.
I Created a Data Class like
Public Class ADDR_VAL_REQUEST
        Private HEAD As ADDR_VAL_HEADER
        Private BODY As ADDR_VAL_BODY
End Class[

 Public Class ADDR_VAL_BODY

        Private AFT As String = ""
        Private LD3 As String = ""
        Private LV3 As String = ""
        Private CITY As String = ""
... and so on

Open in new window


and here my basic sample for the post

      Public Function PostValue(<FromBody()> ByVal value As ADDR_VAL_REQUEST) As String
            If ModelState.IsValid Then
                Console.Write(value.BODY.CITY)

                Return "OK"
            Else

                Return "Error"
            End If

        End Function

Open in new window


Which fails, if i only post the body it works and i can parse the city just fine. So my question what do i need to do to be able to pass
more complex data like mine. It even fails if i send data like this

{		 "ADDR_VAL_BODY": {
			 "LV3": "",
			 "CITY": "NEW YORK"
		}
}

Open in new window

but works for
 {
			 "LV3": "",
			 "CITY": "NEW YORK"
		}

Open in new window


So here is my question, ow do you handle cases where the Data is more complex like in my case ? If the build in parsing does not work, how do i go about to access the posted body to get the json string and parse it via code myself ?
0
We cannot make a REST call using Classic ASP over TLS 1.2. This call is to get the authorization token from Paypal. We have tried lots of code variants with no success:

Example 1:
            Set xmlHttp = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")
            xmlHttp.Open "POST", "https://api.sandbox.paypal.com/v1/oauth2/token", False
            xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
            xmlHttp.setRequestHeader "Accept", "application/json"
            xmlHttp.setRequestHeader "Accept-Language", "en_US"
            basico = "Basic " & Base64Encode(paypal_client_id & ":" & paypal_client_secret)
            xmlHttp.setRequestHeader "Authorization", basico <== "Invalid procedure call or argument"
            xmlHttp.Send "grant_type=client_credentials"

Example 2:
            Set xmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP.6.0")
            xmlHttp.Open "POST", "https://api.sandbox.paypal.com/v1/oauth2/token", False
            xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
            xmlHttp.setRequestHeader "Accept", "application/json"
            xmlHttp.setRequestHeader "Accept-Language", "en_US"
            basico = "Basic " & Base64Encode(paypal_client_id & ":" & paypal_client_secret)
            xmlHttp.setRequestHeader "Authorization", basico
            xmlHttp.Send "grant_type=client_credentials"  <== "An error occurred in the secure channel support"

Also, we've been able to make it with .NET and with PHP at the same server.
0
Want to post data on a rest api with given below code of vb6.  but fails.
 With Req
        .Open "POST", "http://202.166.207.75:9050/api/bill", async:=False
        .SetRequestHeader "Content-Type", "application/json; charset=utf-8"
        .SetRequestHeader "Accept", "application/json"
        Dim UNM As String
        Dim JSON As String
        JSON = Text13
        .Send JSON
       MsgBox CStr(.Status) & " " & .StatusText & vbNewLine _
                       & .GetAllResponseHeaders() & vbNewLine _
                       & String$(40, "-") & vbNewLine _
                       & .ResponseText
0
I'm currently using Roaster to generate a rest class, but i don't know how to implements http annotation (Get, Post,..) ?

Here's what I was trying to generate them with :

public class RestGenerator {
     public static void main(String[] args) {  

    JavaClassSource source = Roaster.create(JavaClassSource.class);
    source.setName("RestController").setPublic();
    source.addMethod().setName("Create").setPrivate().setBody("return null;")
    .addAnnotation();

    source.addMethod().setName("Delete").setPrivate().setBody("return null;")
    .addAnnotation();

    System.out.println(source);
}
}
output :

public class RestController
{

   @MISSING
   private void Create()
   {
      return null;
   }

   @MISSING
   private void Delete()
   {
      return null;
   }
0
Can I use the Telegram Bot API for listetning to message on a private invite-only channel?

Background information:
I was hired to do a gig for doing a Telegram bot that could parse messages and saved them into plain text. Now, I was told that the bot is required to listen to message in invite-only  channels. While doing some research, looks like this is a bit of an issue. I heard some suggest to use the Telegram Client API (instead of Bot), can someone confirm this is possible on the Bot API, or if I actually ave to switch towards Client?
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
>