[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

I try to list posts from a custom taxonomy, but return an error by api rest v2.

https://medicplay.com.br/wp-json/wp/v2/taxonomies/vlogger_series
0
OWASP: Threats Fundamentals
LVL 12
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

Has been almost a year that I switch to Auth0 in order to manage my customer's access to the dashboard of my application. Nowadays I need to implement access for a RESTFULL API.

If I follow the instructions in order to secure the NodeJS app using JWT it works like a charm. The issue is that I am not properly sure on the implementation for the end user in order to get the token needed for access this API.

I thought of creating the tokens on the dashboard or just use a server side implementation for the login/authentication. I did the last using the access to my own database before and worker amazingly. My issue is that I am not completely sure on how to do it for the end user using Auth0.

Would be great if you can guide me in order to implement the login/authentication side of the API using auth0 and nodejs.
0
Hi, Experts,

I am building a node JS web app that will call REST API from one login user info.

https://developers.onelogin.com/quickstart/authentication#web-app

spefically from

https://github.com/onelogin/onelogin-oidc-node/tree/master/1.%20Auth%20Flow

the goal is to attain this

https://developers.onelogin.com/openid-connect/api/user-info

but when you use the example curl request you get this:

[code]curl -XGET "https://openid-connect.onelogin.com/oidc/me" \
> -H "Authorization: Bearer 0e4e2d02323de1e71dda7843d968f20425965488d407fbc952927389b63517ac5663"
{"error":"invalid_token","error_description":"invalid token provided"}[/code]

and

[code]curl -XGET "https://domain.onelogin.com/oidc/me" \
> -H "Authorization: Bearer 0e4e2d02323de1e71dda7843d968f20425965488d407fbc952927389b63517ac5663"
{"error":"invalid_token","error_description":"invalid token provided"}[/code]

the flow is API call goes to one login and one login passes access key so you can get user info. when you try to call user info you get an error.

any help would be greatly appreciated.

thank you
0
I have two aspx pages, default.aspx and index.aspx .
Index page has lot of controls using multiple dropdowns, one for world region, another dropdown for country, another for capitals .
 I want to open index.aspx page from default.aspx page as a bootstrap modal pop up, and load these dropdowns . users can select these and save them in the database.
I have created a mark up in the default.aspx page for the bootstrap Modal.
I am trying to save/load these values in the dropdown based on the user id . so I have this so far, see below.
I added a WebMethod attribute to my function in index.aspx.cs page.

do i make individual calls to populate each drop down ? all the values for each dropdown needs to saved in the database.
when user clicks saves button , how do i send all the selected value in all the dropdown list to be saved? what would that function look like?


$().ready(function() {
    $.ajax({
        type: "GET",
        url: "Default.aspx/GetRegions",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(data) {
            $.each(data.d, function(index, item) {
                $("#ddRegions").get(0).options[$("#ddRegions").get(0).options.length] = new Option(item.Display, item.Value);
            });
        },
        error: function() {
            alert("Failed to load genders");
        }
    });
});  

----------------index.aspx.cs----------------------

 …
0
I am wanting to use REST api with siteminder 12.8 to simply pull a lit of partnerships.
Would anyone have experience setting this up?
0
I am trying to create a method which can retrieve JSON objects.  I’m using the Jama API (https://dev.jamasoftware.com/rest)
To simplify it I am using RestSharp
I start by using the Jama swagger tool to test the interface.  This produces a Response Body.  I take this response body and in visual studio create a new class using the paste special ‘paste JSON as classes’ command.

This results in a new class:

public class Item
    {

        public class Rootobject
        {
            public Meta meta { get; set; }
            public Links links { get; set; }
            public Datum[] data { get; set; }

            public static explicit operator Rootobject(List<object> v)
            {
                throw new NotImplementedException();
            }
        }

        public class Meta
        {
            public string status { get; set; }
            public DateTime timestamp { get; set; }
            public Pageinfo pageInfo { get; set; }
        }

        public class Pageinfo
        {
            public int startIndex { get; set; }
            public int resultCount { get; set; }
            public int totalResults { get; set; }
        }

        public class Links
        {
            public DataFieldsLookup5 datafieldslookup5 { get; set; }
            public DataLockLockedby datalocklockedBy { get; set; }
            public DataFieldsLookup6 datafieldslookup6 { get; set; }
            public DataFieldsLookup3 datafieldslookup3 { get; set; }
        

Open in new window

0
Two or Single Request

Assume we expose both controller and service methods as REST APIs

When we call a controller method - 2 HTTP request or One Http Request will be made ???

Calling service API via REST API will be another HTTP request?

Please advise.
0
I went through the URL - https://dzone.com/articles/quick-guide-to-microservices-with-kubernetes-sprin where both the controller and the service methods are exposed as REST API's

The confusion comes and raises the question whether we need to expose controller methods as REST APIs or Service methods are APIS

if we make both of them as REST APIs then when we call a controller methods - 2 HTTP request might be sent and will cause performance issue.

Please advise.
0
I have a field in a SQL 2014 database that started disappearing after a backup (full or transaction). The rest of the fields are populated, just the one gets emptied. We noticed it during an upgrade of the front end application.
0
REST API and VBA.

I am trying to write some VBA to make a REST API call. This call needs to fall into three stages.

Stage 1 send some authentication information.

I have a URL will I must make a POST call to include a payload of a "username" and "Password". This will then return a authorisation token.

Stage 2

I need to use the token mentioned in Stage 1 to authenticate.

Stage 3

I need to pass a payload to a slightly different URL that contains the name of the query I wish to execute

I have made available the Microsoft XML, v3.0 to my MS Access database.

Can anyone help me design this VBA code?
0
Build an E-Commerce Site with Angular 5
LVL 12
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

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
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
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
Why Diversity in Tech Matters
LVL 12
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

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

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