FAQ Database Discussion Community


REST Jersey server JAX-RS 500 Internal Server Error

java,rest,jersey,jax-rs
I'm calling this method and getting a 500 back from it. In the debugger I'm able to step though it all the way to the return statement at the end. No problem, r is populated as expected after Response.build() is called, the status says 200 OK. But that's not what...

Retrofit updating class PUT error code 301

android,rest,retrofit,put
Maybe this is a silly question but I've been stucked on this for a while. I'm implementing some methods for a restApi. I'm using retrofit and I'm trying to update a client information. To do an update I'm using PUT method but I don't know why I'm always getting a...

Apiary.io - multiple responses (200) with different parameters

rest,restful-architecture,apiblueprint,apiary.io,apiary
I am trying to get different responses passing different parameters but something is not working. This is my API: ## Question [/questions/{question_id}] A Question object has the following attributes: + Parameters + question_id: `1` (number, required) - ID of the Question in form of an integer ### View a Questions...

Adding authorization to routes

ruby-on-rails,rest,routes,authorization
I cannot seem to find a good example for this. I have for example, a TicketController I define a ticket resource in my routes.rb. You only need to be logged in as a customer to GET a ticket, but you must be logged in as an administrator to PUT a...

Spring Boot SSL Client

spring,rest,ssl,spring-boot,ssl-certificate
I am new to Spring Boot. So far I am enjoying it. I have developed a demo SSL rest web server that correctly handles mutual X.509 certificate authentication. Using an IE browser with self signed client & server certificates, I have tested that the demo rest web server is working...

phpunit and http content-type

rest,laravel,phpunit,dingo-api
I have an API built in Laravel (Dingo) and it works perfectly. However I have a problem with implementing phpunit to unit test my API class ProductControllerTest extends TestCase { public function testInsertProductCase() { $data = array( , "description" => "Expensive Pen" , "price" => 100 ); $server = array();...

Send a .jpg image to Wb Service from an Android Device

php,android,rest,slim
I need to send jpg images from my android app to my web service and store it in my database. I'm using android studio and my web service is Php Rest with a slim framework. I reallly have no idea what to do.

Extend MVC Application to REST

asp.net-mvc,rest
I think I may have phrased the question wrong. What I have currently is an MVC Web Application that (by default) uses bearer tokens. This is all well and good but if I want to communicate with any of these APIs outside of the Web Application, I would like to...

Restrict allowed httpMethods using enum

rest,groovy,enums
I am creating connectors for REST API methods. Some methods has the same method name but performs different HTTP methods. For example, createEntity( HttpMethod httpMethod, CreateEntity model ) can perform POST and GET only. What I want is to have an error when httpMethod is supplied with PUT or DELETE....

Apache Nutch REST api

api,rest,web-crawler,nutch
I'm trying to launch a crawl via the rest api. A crawl starts with injecting urls. Using a chrome developer tool "Advanced Rest Client" I'm trying to build this POST payload up but the response I get is a 400 Bad Request. POST - http://localhost:8081/job/create Payload { "crawl-id":"crawl-01", "type":"INJECT", "config-id":"default",...

How to specify supported http operation for a resource in json-ld?

rest,http-method,json-ld
I'm new to JSON-LD and I was wondering if there is any way of specifying supported operation of a resource in JSON-LD without using Hydra's supportedOperation or supportedProperty. Is there any way to specify the context something like : { "@context" : { "@vocab" : "http://www.schema.org/", "data" : "object", "id"...

Mailchimp Ecommerce360 Javascript Implementation

javascript,rest,e-commerce,mailchimp
Wondering if anyone can provide an example of how to pass a request to the /ecomm/order-add function of the Mailchimp API using javascript. This is critical for making use of Mailchimp's Ecommerce360 tracking. Here is documentation from Mailchimps API: https://apidocs.mailchimp.com/api/2.0/ecomm/order-add.php...

remote data fetching inside model object in objective c using AFNetworking

ios,objective-c,rest,model-view-controller,afnetworking-2
In all of my iOS application I use this approach to respect MCV, I want to be sure that my implementation is correct and respects the best practices and the MVC design pattern : Singleton of AFNetworking acting as API for network calls: MyAPI.h : #import "AFHTTPSessionManager.h" #import "AFNetworking.h" @interface...

Spring Boot REST display id of parent only in a JSON response

json,spring,rest,spring-boot
Assume I have the following class: public class ChildEntity { ... @ManyToOne private ParentEntity parent; ... } Now, I have a REST endpoint that retrieves a child entity object from the database, thus my JSON is the following: {"id": "123", "name":"someName", "parent": { //parent fields here } ... } I...

Correct workflow for presence subcription for day/night

rest,lync,ucwa,skype-for-business
In my app, I get Lync Presence of our employees through UCWA. It works fine, but I need to knock to Lync with reportMyActivity every 3-4 minute. I don't need to get presence info at night when employees are not at work, so I stop reportingMyActivity at the end of...

Erro occur when i POST Request to REST api

ios,xcode,rest
i want to send POST Request in REST api but when i see in server side send an error message receive like this type-. **{"messages":{"error":[{"code":404,"message":"Request does not match any route."}]}}** this error is occurs. and my program code is here- NSString *post = [NSString stringWithFormat:@"postBody=%@",@"Rama"]; NSString *postLength = [NSString stringWithFormat:@"%lu",...

.NET web service gets null object

c#,.net,ajax,web-services,rest
I'm trying to save an object using ajax call and .NET REST web service but I get null object on .NET side. Please help me to find out what's the issue. C# Object: [DataContract] public class Customer { [DataMember] public int Id { get; set; } [DataMember] public string Name...

Asp.net Web API Routing by action name fix

asp.net-mvc,rest,asp.net-web-api,asp.net-routing
I found this article at asp.net Learn website. I use this article to help me to create an API method to search in the database by email and not id. However, if you take a look at the article, you will be able to help me fix my problem as...

The refreshed AJAX content hidden due to a CSS property

javascript,jquery,ajax,rest,handlebars.js
I have an image. On clicking that image I get a pop-up. The contents inside the pop-up are generated by AJAX. I am using handlebars for templating. Since the pop-up should be hidden initially, I have set it's property to display:none and I am using toggle to show it on...

Default/Constant values for POST/PUT arguments with Retrofit

java,rest,retrofit
Using the Retrofit REST Client library from Square, is there anyway of providing default/constant values for POST/PUT fields in a call. I know about including constant query parameters by simply including them in the path, but this work for Body parameters. I have an API that looks similar to: POST...

Trying to write a unit test for file upload to a django Restless API

python,django,rest,file-upload,request
I'm writing a fairly small lightweight REST api so I chose restless as the quickest/easiest support for that. I didn't seem to need all the complexity and support of the django-REST module. My service will only received and send json but users need to upload files to one single endpoint....

Not able to hit 2nd services with generated Token

c#,web-services,rest,soap,drupal-services
I have been provided with two services in which ist service is used for login purpose and it will return an xml node token which i to be added as the header in all other services call, In the attached sample code there are two functions in function CreateObject() i...

Exclude Package From Gradle Dependency

java,web-services,rest,gradle
I'm experiencing an issue where multiple versions of the same class are showing up in my classpath. The class in question is javax.ws.rs.core.UriBuilder. The version I want to use is brought in by javax.ws.rs:javax.ws.rs-api:2.0.1. However, we also use the Jira rest client library which has a dependency on the older...

Django update without required fields

django,api,rest,django-rest-framework
I'm trying to execute an update through my API. When I push an update, I do not have all the required fields, because I'm only trying to update the ones that have changed. I get a 400 "This field is required." error. I know the field is required, but I'm...

unable to convert yaml string to map with key “NO” in java

java,rest,yaml
While I am trying to convert yaml string to Map I am getting key change. YAML File:- --- HK: isp: Airtel: AirtelChennal www.enemalta.com: default: defaultEma user1: chennal1 studiodefault: hkDefaultchennal country: DK: denmarkChennal NO: chennal2 Java code:- Yaml yaml= new Yaml(); Map<String,Object> map= (Map<String, Object>) yaml.load(yamlString); output :- {HK={isp={Airtel=AirtelChennal}, www.enemalta.com={default=defaultEma, user1=chennal1},...

How to display WCF HTTP codes in service response

c#,json,entity-framework,wcf,rest
I'm working through a web service using WCF and Entity Framework and I would like to know how to view or return HTTP status codes to the calling clients. The code I have is as follows: IUserService.cs [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest, UriTemplate = "/GetUsers")]...

Intercepting login calls with Spring-Security-Rest plugin in Grails

rest,grails,spring-security
I am using the spring security rest plugin for Grails to provide a login mechanism for an AngularJS app. Login works fine, but I can't figure out how to intercept login calls, in order to store additional statistics on (invalid/valid) login attempts. As I am quite new to Spring Security...

Nutch 2.3 REST curl syntax

rest,curl,nutch
I'm trying to use curl to test out the Nutch 2.X REST API. I'm able to start the nutchserver and inject URLS, but I'm having trouble getting the generate step to work. Here's what I've done: curl -i -X POST -H "Content-Type:application/json" http://localhost:8081/job/create -d '{"crawlId":"crawl-01","type":"INJECT","confId":"default","args":{"seedDir":"/Users/username/myNutchFolder/apache-nutch-2.3/runtime/local/urls/"}}' which when I look at...

Tomcat 7.0 + Chrome dont show JSON

java,json,rest,tomcat,jersey
Iam using Dynamic Web Project 2.5, Jersey and Tomcat 7.0 to create a Java Restful Webservice. I want to response JSON if someone request data. But i always get the following error from Tomcat: That my configurations in relation to web.xml and annotations are ok is demonstrated by using xml...

LinkedIn Group API changes

api,rest,group,linkedin
As far as I can tell, with the new changes to the API's, LinkedIn's Group api's are no longer public at all. Are there any ways to access the posts made in a group without using the Group api? All I'm looking to do is to read the posts from...

In simple RESTful design, does PATCH imply mapping to CRUD's (ORM's) “update” and PUT to “destroy”+“create” (to replace a resource)?

database,rest,http,orm,crud
I'm trying to create a simple REST API and map it to CRUD. I have an ORM (DataMapper) which has methods like create, update and destroy. If I get it right, given a resource {a:'foo',b:'bar',c:'baz'}, performing a PUT {b:'qux'} is supposed to replace the resource and result in the same...

REST api : correctly ask for an action

api,rest,endpoint
I'm currently working on a REST api. I've read a few times how to handle endpoints the right way, using the protocol (post, put, ...) to define which action should be made. Let's say I have a list of quotes. I have : a GET endpoint /quotes that let me...

Count times a value is repeated in data fetched using REST call

javascript,jquery,rest,sharepoint
I'm fetching data from SharePoint using REST, and everything works just fine, except that I would like to count the times the same item appears. This is the jQuery: var url = "https:xxxxxxxx/_vti_bin/ListData.svc/RMSD_Tasks?$orderby=TypeOfIssueValue asc,StatusValue desc&$filter=StatusValue ne 'Completed'&groupby=TypeOfIssueValue/StatusValue"; var lastIssue = ''; $.getJSON(url, function (data) { $('#totalCounter').text(data.d.results.length); for (var i =...

RESTful routing best practice when referencing current_user from route?

ruby-on-rails,rest
I have typical RESTful routes for a user: /user/:id /user/:id/edit /user/:id/newsfeed However the /user/:id/edit route can only be accessed when the id equals the current_user's id. As I only want the current_user to have access to edit its profile. I don't want other users able to edit profiles that don't...

Spring service and Spring web app in one

spring,web-services,rest,spring-mvc,web
I'm making a Spring RESTFUL service and i wonder. Can I make a Spring RESTFUL service combine with a web app in a project. If it is possible, how to configure it? ....

Sailsjs login API

rest,sails.js
I have a sailsjs project that has only users ( email and password ) to authenticate. Here's the code: routes.js 'PUT /login': 'UsersController.login' UsersController.js: login: function (req, res) { // Try to look up user using the provided email address Users.findOne({ correo: req.param('correo') }, function foundUser(err, user) { if (err)...

Json response with byte[], how to store as file in C#?

c#,.net,json,wcf,rest
I'm calling a WCF service using HttpClient that returns a byte[] (pdf file) via rest/json. I cannot seem to be able the write the bytes correctly to a file on my pc because if I open the created file in notepad, it will just show the byte[] values (i.e. [23,44,21,etc])....

Authenticate to access the server with Java Neo4j Rest Api

java,rest,neo4j
I'm starting to use the Neo4j Rest Api but when I try to connect the server I get the following error : { "errors" : [ { "code" : "Neo.ClientError.Security.AuthorizationFailed", "message" : "No authorization header supplied." } ] } This error seems to be normal because I am not authenticating...

How to respond in Middleware Slim PHP Framework

php,rest,authentication,middleware,slim
I am creating middleware for auth into REST API. My API is created using Slim PHP Framework ,which in case provide great features to build APIs. One of this feature is Middleware. I need to check credentials in Middleware and respond with an error (HTTP code with JSON descriptions) to...

AngularJS $resource Custom Action for Requesting a Password Reset

angularjs,rest,ngresource,angularjs-1.3
I'm just starting to use ngResource in a project to consume my RESTful endpoints. Is this how you would implement a user password reset using $resource? Looks weird passing the email address as a URL parameter. .factory('User', ['$resource', function ($resource) { var paramDefaults = {id: [email protected]'} var actions = {...

how to do cancel requests in GCD without operation queue

ios,objective-c,rest,grand-central-dispatch
I'm implementing an iOS app which make requests using REST service. And I want to cancel all the previous REST calls when I make a new call. Can I do it in the global queue in GCD without Operation Queue? Thanks

How to page REST calls in a future with Dispatch and Scala

scala,rest,future
I use Scala and Dispatch to get JSON from a paged REST API. The reason I use futures with Dispatch here is because I want to execute the calls to fetchIssuesByFile in parallel, because that function could result in many REST calls for every lookupId (1x findComponentKeyByRest, n x fetchIssuePage,...

Parse REST API not returning Client Key

android,rest,parse.com
I'm trying to create Parse apps on the fly and use the keys while building my Android application. The API works great except for one point, it does not return the Client Key. { "appName": "my new app", "dashboardURL": "https://www.parse.com/apps/my-new-app--30", "applicationId": "oQqMyipkIgxYFXRROYTZsREfTcXp770awB1yMVrs", "javascriptKey": "XAPZ7DoZHQIhMC8vPqN1m79wRIQyIXv7tmVIHmRs", "windowsKey": "ZsyfFr0WtaQx6tsCokNSmTvjd05QCbCbMLzpChvP", "webhookKey": "LyXnWJ3tRH56gK19KC1fjTvoUbdSUZoXhyO6khoT", "restKey":...

unable to convert yaml string to json string using java

java,json,rest,yaml
I want to convert a yaml string to a json string by using "jyaml", kindly some one help me to resolve this YAML string :- Korea: www.gozoculture.com: default: jhfjfjfj www.5plus5.gov.mt: default: jhfjfjfj www.ces.gov.mt: default: cesDefault user5: chennal5 isp: Tata DoCoMo: chennalisp1 Hathway: chennalIsp Hong Kong: chennalisp2 Aircel: chennalIspaircel Airtel: chennalIspAirtel...

What's the best way to map objects into ember model from REST Web API?

json,rest,ember.js,asp.net-web-api,ember-data
The topic of this post is: my solution is too slow for a large query return. I have a Web Api serving REST results like below from a call to localhost:9090/api/invetories?id=1: [ { "inventory_id": "1", "film_id": "1", "store_id": "1", "last_update": "2/15/2006 5:09:17 AM" }, { "inventory_id": "2", "film_id": "1", "store_id":...

WooCommerce REST API v2: How to process payment?

rest,woocommerce,payment-gateway
Using the WooCommerce REST API v2, I'm successfully creating an order in a pending, unpaid state. I can see that I can set the order.payment_details.paid field to true which will create the order in a completed state and send out a completed order email, but it doesn't actually process the...

Java Restful Service eclipse tomcat HTTP Error 404

java,rest,tomcat,jersey,jersey-2.0
i try to keep up with a java rest service. So i found some tutorials, which explain always the same way. But i cant get this running :(. I made Dynamic Web Project in Version 2.5 and Tomcat 7.0 in eclipse. Then i load following jars to WEB-INF/lib My Projectname...

Using a authentication login a a parameter in requesy header in frisby

javascript,rest,automated-tests,web-api-testing,frisby.js
I'm trying to a test that requires an authentication token login using frisby, the problem is: the response of my request is a string and not a JSON and i still havent figured out how to get it working. I've read a few examples that i found googling but they...

How can I get json objects without the object number?

javascript,jquery,json,rest
I have a simple json object that spits out 4 items that have completely different properties inside each one. I have got the json being displayed with the 4 objects that are called meta.work_content like so: [Object, Object, Object, Object] I can open these in console and see the objects...

REST API design for cloning a resource

api,rest,post,yaml,webdav
I am writing a YAML document using swagger to design a RESTful API method for cloning a resource. I have a few options and don't know which would be best. Please can someone advise? Options: Relinquishing the responsibility of cloning the resource object to the consumer (where the consumer assigns...

Sencha/Extjs rest call with all parameters

json,rest,extjs,sencha-touch
I'm using ExtJs 5.1.1 and I've written a simple view with a grid, and selecting one row the corresponding model property are editable in some text fields. When editing is completed the button 'save' call Model.save() method, which use the rest proxy configured to write the changes on the server....

How to make Jersey Unit test for Post method

java,rest,junit,jersey,jax-rs
Questions How do create a Jersey Unit Test for a POST? How do I add post parameters? What I tried For a GET it is easy (https://jersey.java.net/documentation/latest/test-framework.html): @Test public void test() { final String hello = target("hello").request().get(String.class); assertEquals("Hello World!", hello); } For a post it is more diffuse. I managed...

Remove resource wrapper from CakePHP REST API JSON

rest,cakephp,cakephp-2.2
My question is similar to this one. I understand the answer given there. The OP of that question doesn't seem to have my issue. I am using CakePHP 2.2.3. I am fetching a resource like this: http://cakephpsite/lead_posts.json and it returns results like this: [ { "LeadPost": { "id": "1", "fieldA":...

backbone persistent login - login removed on browser quit

javascript,rest,authentication,backbone.js,login
I am working on a backbone application that hooks into RESTful API. One problem I having at the moment, is that a user can be logged, they can then close there browser, reopen it go to my application and be logged out. Is is possible to make a login persistent...

REST API with token based authentication

angularjs,codeigniter,api,rest,token
I want to develop a web site with AngularJS. On the backend side I will use Codeigniter REST framework. I have some security issues and I don't want to start developing without fixing them on my mind. I don't want to use something like api key because it will be...

Google Short URL API: Forbidden

php,rest,google-url-shortener
I have what I think is correctly written code yet whenever I try and call it I'm getting permission denied from Google. file_get_contents(https://www.googleapis.com/urlshortener/v1/url): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden This isn't a rate limit or anything as I currently have zero ever used... I would have...

How to expose existing REST API through Azure Service Bus (or through something else)

rest,azure,azureservicebus
I have an existing on-premise REST API from an external vendor. I'd like to expose this API unmodified to the outside world through an Azure website. So I have customers that run this API on-premise and I'm developing a PaaS/SaaS app that should access these on-premise API's. I also have...

PHP: Secure a Rest Service with a Token mixed with Timestamp

php,rest,security,amazon-web-services,token
I have a rest service that my website calls it and I want to secure it from calling outside of my website as much as possible. I want to create a token mixed with timestamp, so the user can only call the service in 10 minutes (for example) with the...

Link to another resource in a REST API: by its ID, or by its URL?

json,api,rest,api-design,hateoas
I am creating some APIs using apiary, so the language used is JSON. Let's assume I need to represent this resource: { "id" : 9, "name" : "test", "customer_id" : 12, "user_id" : 1, "store_id" : 3, "notes" : "Lorem ipsum example long text" } Is it correct to refer...

Is JSON better than XML? Which one is more secured? [duplicate]

android,json,xml,web-services,rest
This question already has an answer here: What is the difference between json and XML? [closed] 3 answers I'm very much clear about using JSON and XML, but still while comparing each other I cant find differences related to security. Which one is more secure? Which one I should...

How to manipulate local files with webdav

javascript,jquery,rest,file-upload,webdav
Hi so I just found out that webdav protocol allows for manipulations of local files through a browser. I have it already set up in the back end. What I would like to know is how to make it work on front end. I am using javascript with jQuery. For...

simple model when requesting collection and extended model when requesting resource - how

rest,architecture,restful-architecture
I have the following URI: /articles/:id, where article is a resource on web-service and have associated model/class. Now I need to return only partial data for each resource (to save bandwidth and make for speed) when collection is requested, but when a single item is requested from collection I need...

Stuck with nested serializer using Django Rest Framework and default user

django,api,rest,django-rest-framework,serializer
The models and serializers are described in the pastebin: http://pastebin.com/ZxzxWY7V In my database I have a user which also has a member profile and a set of credentials attached to it. Now... when I run this as is and try to pull a user using the AuthUserModelSerializer I get the...

Can't save json data to variable (or cache) with angularjs $http.get

json,angularjs,web-services,rest
I have weird angularjs problem. I'm trying to fetch data from Rest Webservice. It works fine, but I can't save json data to object. My code looks like: services.service('customerService', [ '$http', '$cacheFactory', function($http, $cacheFactory) { var cache = $cacheFactory('dataCache'); var result = cache.get('user'); this.getById = function(id){ $http.get(urlList.getCustomer + id).success(function(data, status,...

REST is built for the Web then what about SOAP? [closed]

java,rest,soap
I read an article where they are telling "REST is built for the Web". then what about SOAP? We also can not access SOAP web services without web.So I am confused.plz clarify what it means "REST is built for the Web", why they did not mentioned it for SOAP? Below...

Unable to select values from the select list

javascript,jquery,rest
my select list is getting populated via a service call but I cannot select any of the values from the select list. AJS.$("#select2-actor").auiSelect2( { placeholderOption: 'first', formatResult: function(actor) { return '<b>' + actor.text ; }, data: function () { var data = []; AJS.$.ajax({ dataType: 'json', type: 'GET', url: AJS.params.baseURL+"/rest/leangearsrestresource/1.0/message/list/{actor}",...

How To find a WebSocket from a REST bean

rest,jboss,websocket
I have a javascript client that connects to a server via websockets and sends data via ajax to a server. Once the server finished processing the data, I want to send a message via the websocket to the client. Problem is: How do I find the WebSocket from the REST...

Laravel: Retrieve polymorphic attributes efficiently

rest,laravel,polymorphism,eloquent
My actual Question is: How to return attributes to the client which I actually need, throw the rest away and be as efficient as possible? So, I have a construction where I basically have media objects, which can be of different types, like video, picture, link and so on. This...

Consuming and exposing webservices in one project (.NET)

.net,web-services,rest,soap
What is best practice concerning consuming and exposing webservices in one project? (.net) I need to create a rest webservice to expose data. The rest webservice would need to consume this data from another (SOAP) webservice from a third party. (The data needs to be merged with data present in...

REST-API Different Content-Type on Error Response

java,json,api,rest,spring-mvc
Since some weeks I'm working on an rest api using spring-mvc. The REST-API is working properly and I`m almost done until one last problem when it comes to error handling with specific error-objects. The REST-API is using JSON as format to serialize Java-Objects. When an error occurs during service-execution an...

Getting response but view is not updating - AngularJS

angularjs,rest,view,binding
I am trying to get the response from a url and populate in the view, but I am do not see the view getting updated. Help me to resolve this issue. Thanks Source <!DOCTYPE html> <html ng-app="myModule"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> </head> <body ng-init="priceList='promo03'"> <div ng-controller="PricingController" > <div ng-repeat="item in finalList...

get_relationsips return empty result set in sugarcrm

rest,suitecrm
Hi i am building an external application interacting with the SuiteCRM using REST API. I have created a module "franchise" which would have many leads in it, so created a one to many relationship between franchise and leads. Now i am trying retrieve a lead record and the franchise associated...

Jersey JUnit Test: @WebListener ServletContextListener not invoked

java,rest,junit,jersey,jax-rs
I created this test in Jersey (from the docs), which works fine, with one problem: the @WebListener ServletContextListener is not being invoked. The Resource classes that I need to test rely on an attribute set on the ServletContext by the ServletContextListener. Can I make sure it is invoked, or can...

flask restful: passing parameters to GET request

python,rest,flask,flask-restful
I want to create a resource that supports GET request in following way: /bar?key1=val1&key2=val2 I tried this code, but it is not working app = Flask(__name__) api = Api(app) class BarAPI(Resource): def get(key1, key2): return jsonify(dict(data=[key1, key2])) api.add_resource(BarAPI, '/bar', endpoint='bar') Thanks!...

Send rest request after async responses volley

android,rest,request,android-volley
I searched about this topic and I didn't found something to clear my doubts. My problem is that I must fill some form fields with data that I have in a server using a rest api. Basically I throw 3 different independent requests, as they are independent I throw them...

Springboot REST application should accept and produce both XML and JSON

java,xml,rest,jackson,spring-boot
I am working on Springboot REST API. My application should consume and produce both XML and JSON. I came across the Jackson json Xml dependency. <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</artifactId> <version>2.5.4</version> </dependency> I added this in my pom.xml. Now I am able to accept xml input but the values are null when mapped...

How to return RSS with REST service?

java,rest,rss,jersey,rome
I'm using ROME for RSS feed generating and Jersey as REST service. Here is my RSS feed generation. public SyndFeed generate() { SyndFeed feed = new SyndFeedImpl(); feed.setFeedType( "rss_2.0" ); feed.setTitle( "My Site" ); feed.setLink("http://example.com"); feed.setDescription("Test Site."); List<SyndEntry> entries = new ArrayList<SyndEntry>(); SyndEntry entry = null; SyndContent description = null;...

Angular $http.get always get ERROR consuming local Restful Service

java,javascript,json,angularjs,rest
I have an error and I am getting confuse, I have created a simple Java EE 7 project using Jersey. I am returning this class in my Rest Rervice: @XmlRootElement public class LocationDTOx { private Long id; private String tittle; private String description; private Long parent; //Getter and setters... And...

Using .update with nested Serializer to post Image

django,rest,django-models,django-rest-framework,imagefield
I have an ImageField. When I update it with the .update command, it does not properly save. It validates, returns a successful save, and says it is good. However, the image is never saved (I don't see it in my /media like I do my other pictures), and when it...

AJAX call not failing or succeeding

jquery,ajax,json,rest,jsonp
I am trying to get data from this AJAX call, the error function is called, but I can't figure out why? Debugging me shows that the GET works correctly. Is there something I'm missing from here? The API key can be regenerated, not a security risk for me. $.ajax( {...

RestFul web service which reads properties file

java,rest
I have got couple of Jersey REST Web services say SendPassword and ResetPassword whose purpose is to send email . For sending email , i have configured a properties file under tomcat and all this works fine The code of the SendPassword.java is somewhat this way @Path("/sendpassword") public class SendPassword...

Specify user handlers for JAX-RS when using annotation scanning

rest,annotations,websphere-liberty,apache-wink
How to specify user handlers for JAX-RS when using annotation scanning? I am following this link and have created my custom handlers. I have annotated my Application subclass as: @ApplicationPath("rest") public class RestfulResourceLoader extends Application { } so that I don't have to entry in web.xml file. What I am...

PHP Multiple cURL requests to REST API stalls

php,rest,cakephp,curl
Currently I have a system that sends multiple requests to a REST API. It is structured something like this: foreach ($data as $d) { $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_HTTPHEADER, (array of data here)); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec( $ch ); $retry...

C# Rest API returns string with double quotes

angularjs,rest,typescript,umbraco7
I have this silly problem, which I hope someone could help me enlighten. I am building an extension for Umbraco7's backoffice, for that I need to receive a simple string. My problem is the string return from the REST api contain double quotes and then AngularJS wont model bind. Here's...

(CORS) How does the browser know when to do a pre-flight request

javascript,rest,dom,xmlhttprequest,cors
So I have been using CORS for a short time now, I just read up on how it works behind the scenes. My question is how does the browser know when to do a pre-flight request? There is no issue involved right now, as the browser seems to be working...

Method not found in Web API 2

c#,rest,asp.net-web-api
Im trying to figure out how to use Web API. I have gone through some tutorials and now Im trying to set up my web service. I have a really hard time trying to figure out why it cant find my methods. To me it just seems like random (the...

Spring Data Rest executes query but returns 500 internal Server Error

java,spring,rest,spring-boot,spring-data-rest
I am using spring boot and spring data rest and I am facing a 500 internal server error, but no messages are displayed in console. I have the following: ProdutoVendaRepository.java public interface ProdutoVendaRepository extends PagingAndSortingRepository<ProdutoVenda, Integer> { @Query("SELECT new br.com.contoso.model.VendaPorFamilia(b.nome, SUM(i.valorMultiplicado)) FROM ProdutoVenda i JOIN i.produto o JOIN o.familia b...

Do we HAVE to generate and use client libraries to use Google App Engine's Endpoints?

ios,swift,rest,google-app-engine,google-cloud-endpoints
I am currently developing an Swift iOS app with GAE Endpoints for the RESTful API. It seems like all the tutorials and documents make you generate and use client libraries if you need to use the API on the client side. I was wondering if it's possible for me to...

Ruby on Rails - Help Adding Badges to Application

ruby-on-rails,ruby,rest,activerecord,one-to-many
I'm creating a rails application that is a backend for a mobile application. The backend is implemented with a RESTful web API. Currently I am trying to add gamification to the platform through the use of badges that can be earned by the user. Right now the badges are tied...

Python Flask persistent object between requests

python,rest,flask,raspberry-pi
I am creating a web interface for OMXPlayer on the Raspberry Pi. I'm trying to create a more REST like API for controlling the video while its playing. The issue I'm having is how to control the video while it is playing. Currently I can create a Player object which...

Allow only GET in REST API

rest
I'm developing a REST API. I need a way to get all Countries, to allow the user to select several and save an application configuration. I'm thinking in a resource with just a GET option, since INSERT/UPDATE/DELETE are not allowed. Does it make sense?. In general, what is the best...

Unable to upload file to Sharepoint @ Office 365 via REST

javascript,ajax,rest,sharepoint,office365
I'm having trouble creating/uploading files via Microsoft's REST API (or at least that's what they call it) for Sharepoint running on Office 365. It looks like I'm able to authenticate all right, but I'm getting 403 Forbidden when I try to create a file. The same user can upload a...

Not able to create a WCF RestFul Service's client

asp.net,web-services,wcf,rest
I am newbie with web services. I am trying to create a WCF Restful web service . I have implemented a simple service that accepts parameter name and when the client requests the service it prints hello with name. I have created a web client and added the reference of...

Spring MVC - How to return simple String as JSON in Rest Controller

java,json,spring,rest,spring-mvc
My question is essentially a follow-up to this question. @RestController public class TestController { @RequestMapping("/getString") public String getString() { return "Hello World"; } } In the above, Spring would add "Hello World" into the response body. How can I return a String as a JSON response? I understand that I...

@RestController throws HTTP Status 406

java,spring,rest,maven
I am working on a basic Hello World program using Spring and Restful webservices. But when I try to call my service I am getting below error message: HTTP Status 406 - description - The resource identified by this request is only capable of generating responses with characteristics not acceptable...

How to avoid abusive use of REST endpoint [closed]

java,javascript,rest
how can I avoid abusive use of my REST API? For example, I have a website where certain actions earn a bunch of points which are stored within a user account. So technically, when ever this action is performed, I call my REST endpoint to add the points to the...

No module named http_client error when trying to run django with django rest framework

python,django,rest
I am trying to create a simple API using django rest framework. In the view i have the following code. from django.shortcuts import render from moviestash.models import Movie from moviestash.serializer import MovieSerializer from rest_framework import generics #List all movies and add movies class MovieList(generics.ListCreateAPIView): queryset = Movie.objects.all() serializer_class = MovieSerializer...

How to send a JsonObject in JerseyClient POST call?

java,json,rest,jersey,jersey-client
I have a POJO class, in which one element is of type JSONObject : public static class TestRequest { org.json.JSONObject data; } I want to send it over a POST call using JerseyClient. I tried this : Client client = new Client(); TestRequest request = new TestRequest(); Map<Long, String> data...

ServiceStack Authenticates both iOS Apps when one is logged in

rest,xamarin,servicestack,restful-authentication,servicestack-auth
I'm using the awesome ServiceStack to implement my REST backend which serves two iPhone apps written in Xamarin. Everything works great but i'm struggling in getting sessions to work correctly when the two apps are installed on the same device ! The issue is that if I login in one...

Angularjs: View not updating list after POST

javascript,angularjs,rest,resources
I am currently working on a small angularjs app which is basically a user profile management app. The problem i am having is with adding users dynamically. When i enter the user data, it successfully POST's to my local server i have setup, BUT i have to refresh the page...