Menu
  • HOME
  • TAGS

Nutch 2.3 REST curl syntax

rest,curl,nutch

From the user mailing list, I learned the args to use for generate are: "normalize":boolean "filter":boolean "crawlId":String "curTime":long "batch":String...

Getting response but view is not updating - AngularJS

angularjs,rest,view,binding

Final{"actualPrice":10,"button":"Check Availability","content":"£5 for 6 months, £10 a month for further 6","description":"Fiber broadband","discountedPrice":5} This output represents object but not array, suppose you wait for array. Therefore ng-repeat prints nothing. Should be something like: [ { "actualPrice": 10, "button": "Check Availability", "content": "£5 for 6 months, £10 a month for further...

Default/Constant values for POST/PUT arguments with Retrofit

java,rest,retrofit

Maybe one option would be to send an object, which encapsulates all your values, instead of all string values separately? The object would implement your default values. For example, you could create a class: public class CreateObject { private String type = "constant"; private String value; private String otherValue; public...

Restrict allowed httpMethods using enum

rest,groovy,enums

Is that what you're looking for: public enum HttpMethod { POST, DELETE, GET, PUT, HEAD, TRACE, CONNECT, PATCH } class EntityQuery { String field1 String field2 } def createEntity(HttpMethod h, EntityQuery q) { if(!(h in [HttpMethod.POST, HttpMethod.GET])) { throw new Exception('Only POST and GET methods allowed') } } createEntity(HttpMethod.PUT, new...

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

java,json,spring,rest,spring-mvc

A String as JSON? Proper JSON needs a key and a value { key: value } So either return text/plain (as in Return only string message from Spring MVC 3 Controller) OR wrap your String is some object public class StringResponse { private String response; public StringResponse(String s) { this.response...

REST API design for cloning a resource

api,rest,post,yaml,webdav

Influenced by project requirements and the range of preferences amongst members in my team, option 1 will serve us best at this stage. Conforming to the standard HTTP methods will simplify and clarify my API There will be a single, consistent approach to cloning a resource. This outweighs the issue...

Not able to create a WCF RestFul Service's client

asp.net,web-services,wcf,rest

I found the answer myself. In my service I had not declared an endpoint for met data exchange due to which when I was trying to add the reference of the service to the client the required app.config was not being generated. Adding the end point for metadata exchange solved...

Method not found in Web API 2

c#,rest,asp.net-web-api

Problems with the GET method For the HTTP Get method, there is a problem with your routing. You have declared the GET route as this: [Route("api/contentfile/{id}")] but then the method parameter is declared as this: public IHttpActionResult GetContentFiles(int count) When using Attribute-based routing, the parameter names have to match. I...

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

java,javascript,json,angularjs,rest

If AngularJS is accessing your local REST API, the fact that you're running it in a browser on a different port, it counts as a different origin, per the rules of CORS (separate port means separate origin). Two pages have the same origin if the protocol, port (if one is...

Retrofit updating class PUT error code 301

android,rest,retrofit,put

Finally I solved it. The problem was that we had two different Client objects and the one that you fetch is the one that you must change and use it to upload with PUT. I hope that this help somebody....

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

python,django,rest,file-upload,request

I tried to fix this but in the end it was quicker and easier to switch to the Django-REST framework. The docs are so much better for Djano-REST that it was trivial to set it up and build tests. There seem to be no time savings to be had with...

How to manipulate local files with webdav

javascript,jquery,rest,file-upload,webdav

So I figured it out a while ago. I was thinking the wrong way. It is not the client that will do anything it will be the server. So the client can make a regular http call and just change the "type" string from get or what ever to MKCOL...

Spring Data Rest executes query but returns 500 internal Server Error

java,spring,rest,spring-boot,spring-data-rest

Hum... This is strange but I found this question and added a controller to call the method and it worked like a charm... Obv this is not a fix, but it is a good workaround... EDIT: The error happens because it is expecting an entity, so all I had to...

How to send a JsonObject in JerseyClient POST call?

java,json,rest,jersey,jersey-client

You should add (de)serializators for JSONObject - jackson-datatype-json-org <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-json-org</artifactId> <version>2.4.0</version> </dependency> And register module: ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JsonOrgModule()); ...

REST Jersey server JAX-RS 500 Internal Server Error

java,rest,jersey,jax-rs

IllegalAnnotationException: Class has two properties of the same name "list" Look at your two model classes XmlMessageBean and ResponseList. Do you see any difference? The main difference (and the cause for the error), is the @XmlAccessorType(XmlAccessType.FIELD) annotation (or lack there of). JAXB by default will look for the public...

Stuck with nested serializer using Django Rest Framework and default user

django,api,rest,django-rest-framework,serializer

By default DRF will look at an attribute on the User model named after the serializer's field (member here). However the related name is profile. This can be worked around by passing the source="profile" to your MemberProfileSerializer....

Extend MVC Application to REST

asp.net-mvc,rest

The /Token endpoint already provides all the functionality you need in order to use [Authorize] on your WebAPI methods. The general process to make this work would be something like the following: Client establishes a POST request to http://somesite.com/Token. The Content-Type header should contain x-www-form-urlencoded. The payload body should include...

Authenticate to access the server with Java Neo4j Rest Api

java,rest,neo4j

In Jersey 1.x you can supply your client instance with a filter dealing with authentication: Client client = Client.create() client.addFilter(new HTTPBasicAuthFilter("neo4j","<mypwd>")); // <-- that's it! WebResource resource = client.resource( "http://localhost:7474/db/data/transaction/commit" ); ClientResponse response = resource.accept( MediaType.APPLICATION_JSON ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, someStringContainingJsonPayload); ...

Springboot REST application should accept and produce both XML and JSON

java,xml,rest,jackson,spring-boot

Try to add a @XmlRootElement(name="myRootTag") JAXB annotation with the tag you use as the root tag to the class MatchRequest. I have had similar issues when using both XML and JSON as transport format in a REST request, but using moxy instead of Jackson. In any case, proper JAXB annotations...

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

rest,grails,spring-security

Yes, you can provide a custom bean that implements the RestAuthenticationSuccessHandler. Take a look at the API documentation for the class to see what you need to implement. Then it's as simple as overriding the bean in your application context: // Resources.groovy restAuthenticationSuccessHandler(MyCustomRestAuthenticationSuccessHandler) { renderer = ref('accessTokenJsonRenderer') } It might...

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

rest,architecture,restful-architecture

I suggest using the approach suggested here with a fields query parameter. If the API is going to be open to everyone to use and client usage is going to be unpredictable, then by default you probably need to limit the fields that you return. Just make sure you document...

get_relationsips return empty result set in sugarcrm

rest,suitecrm

I got my answer from the SuiteCRM forum. We could get the relationships by using the following parameters: $get_franchise_lead_parameters = array( 'session'=>$sessionID, 'module_name'=>'Leads', 'module_id'=>$lead, 'link_field_name'=>'name of the linked field', 'related_module_link_name_to_fields_array' => array(), 'related_fields' => array( 'id', 'name', ), 'deleted' => '0', ); ...

Remove resource wrapper from CakePHP REST API JSON

rest,cakephp,cakephp-2.2

Use the Hash utility to rewrite the results returned before setting the data for the View:- class LeadPostsController extends AppController { public $components = array('RequestHandler'); public function index() { $records = $this->LeadPost->find('all', ['limit' => 20]); $this->set(array( 'leadposts' => Hash::extract($records, '{n}.LeadPost'), '_serialize' => 'leadposts' )); } } Here Hash::extract($records, '{n}.LeadPost') will...

How to display WCF HTTP codes in service response

c#,json,entity-framework,wcf,rest

Probably the most simple approach would be to wrap your results into generic response objects [DataContract] public class Response<T> { [DataMember] public T Result { get; set; } [DataMember] public int Status { get; set; } } // then your declaration Response<List<User>> serverResponse = Response<List<User>>(); // on success serverResponse.Result =...

Unable to upload file to Sharepoint @ Office 365 via REST

javascript,ajax,rest,sharepoint,office365

To me it just seems a bit light, visit this link https://msdn.microsoft.com/en-us/library/office/dn769086.aspx on technet, and compare your upload function to this: // Add the file to the file collection in the Shared Documents folder. function addFileToFolder(arrayBuffer) { // Get the file name from the file input control on the page....

Tomcat 7.0 + Chrome dont show JSON

java,json,rest,tomcat,jersey

Seeing from your previous question, you seem to missing a provider for JSON/POJO support. You can see this answer for all the jars and dependencies you need to add to your project. Note: The linked answer shows 2.17 jars for Jersey, but you are using 2.18. The answer also provides...

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

javascript,rest,dom,xmlhttprequest,cors

The browser will send a preflight request if: You add custom headers to your request You use a method other than GET, HEAD or POST You use POST with an unusual Content-Type. More details here: HTTP access control (CORS), Preflighted requests...

The refreshed AJAX content hidden due to a CSS property

javascript,jquery,ajax,rest,handlebars.js

You could attempt to try and use JQuery .css() .css("display","block"); // So it would look like this .html(data).css("display","block"); or you could add a setTimeout of 1 or 2 seconds setTimeout(function(){ // Add what you need inside this }, 2000); ...

Correct workflow for presence subcription for day/night

rest,lync,ucwa,skype-for-business

If you don't do reportMyActivity your Application will be drained, because assumed inactive. I think you only have two options then: Keep doing reportMyActivity regurarly also at night, you'll just stop extending presence subscription. Very likely you'll have to manage access token expiration too, which is normally 8 hours valid...

RESTful routing best practice when referencing current_user from route?

ruby-on-rails,rest

I would've added special routes for current user profile actions, in this case you don't have to check anything. Just load and display the data of current user. For example: /my-profile/edit /my-profile/newsfeed It's not that RESTful but you don't have to put extra checks keeping your code clean. If you...

How to respond in Middleware Slim PHP Framework

php,rest,authentication,middleware,slim

You cannot use halt in middleware: http://stackoverflow.com/a/10201595/2970321 Halt should only be invoked within the context of a route callback. Instead, you could manually generate a 400 response using PHP's header along with exit: header("HTTP/1.1 400 Access denied"); exit; Alternatively, you could define a new type of Exception: class AuthException extends...

How to avoid abusive use of REST endpoint [closed]

java,javascript,rest

The answer is simple: Don't use the UI as the definitive state for your users. Stack Overflow is actually a great example of this. When I voted up your question, the UI only updated after the REST call to the backend completed successfully with no errors. So you should be...

backbone persistent login - login removed on browser quit

javascript,rest,authentication,backbone.js,login

You might be missing the expires= part of the cookie. You can also add an expiry date (in UTC time). By default, the cookie is deleted when the browser is closed: document.cookie="username=John Doe; expires=Thu, 18 Dec 2013 12:00:00 UTC"; http://www.w3schools.com/js/js_cookies.asp...

How to return RSS with REST service?

java,rest,rss,jersey,rome

Jersey does not know how to map an instance of SyndFeed to XML. This works. @Path("stackoverflow") public class RomeRessource { @GET @Path("/feed") @Produces("application/rss+xml") public Response getFeed() throws IOException, FeedException { final SyndFeed feed = generate(); // Write the SyndFeed to a Writer. final SyndFeedOutput output = new SyndFeedOutput(); final Writer...

Sencha/Extjs rest call with all parameters

json,rest,extjs,sencha-touch

You need to specify a writer config on your proxy with writeAllFields: true. By default it's false, and the default writer itself is just {type: 'json'}.

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

android,json,xml,web-services,rest

In compare to JSON and XML , there is no difference in security but JSON is much faster than XML thats why we prefer JSOn over XMl...But if you see from security point of view than you can go for SOAP

Apache Nutch REST api

api,rest,web-crawler,nutch

At the time of this posting, the REST API is not yet complete. A much more detailed document exists, though it's still not comprehensive. It is linked to in the following email from the user mailing list (which you might want to consider joining): http://www.mail-archive.com/user%40nutch.apache.org/msg13652.html But to answer your question...

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

I think this should fix your problem: export default DS.RESTSerializer.extend({ primaryKey: 'inventory_id' }); With this parameter Ember Data will map inventory_id to it's id parameter....

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

json,angularjs,web-services,rest

$http.get is asynchronous. When cache.get or return result are executed, HTTP request has not completed yet. How are you going to use that data? Display in UI? E.g. try the following: // Some View <div>{{myData}}</div> // Controller app.controller('MyController', function ($scope) { $http.get('yoururl').success(function (data) { $scope.myData = data; }); }); You...

.NET web service gets null object

c#,.net,ajax,web-services,rest

Possibly the mistake in this line var data = '{ "c:":{"Id": "1", "Name": "myname"}'; should be var data = '{ "c":{"Id": "1", "Name": "myname"}'; ...

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

json,spring,rest,spring-boot

Basically returning entities directly from endpoints isn't a good idea. You make very tight coupling between DB model and responses. Instead, implement a POJO class that will be equivalent of the HTTP response you sent. This POJO will have all ChildEntity fields and parentId only and will be constructed in...

how to do cancel requests in GCD without operation queue

ios,objective-c,rest,grand-central-dispatch

GCD does not provide an API to cancel blocks. So you will have to implement this cancellation yourself. The easiest way probably would be to set a global flag 'canceled' and check that inside of your blocks. If the flag is set, immediately return from your block. Then after all...

C# Rest API returns string with double quotes

angularjs,rest,typescript,umbraco7

I found another way than @basarat is suggesting, from the comment form @ArghyaC. The problem is that Umbraco's REST controller builds on asp.net's ControllerApi, and defaults to xml. The apostrophes comes from the xml serialize. The solution is simple force json as the return value instead. I don't dare to...

Ruby on Rails - Help Adding Badges to Application

ruby-on-rails,ruby,rest,activerecord,one-to-many

Take a look at merit gem. Even if you want to develop your own badge system from scratch this gem contains plenty of nice solutions you can use. https://github.com/merit-gem/merit

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

rest,http-method,json-ld

No, you can't specify it in the context. What you can do, however, is to bind an operation to a property in a Hydra ApiDocumentation (example 10 in the spec) and reference it via an HTTP Link header.

Parse REST API not returning Client Key

android,rest,parse.com

This was a minor bug in the Parse REST API. They fixed it within 48 hours after reporting.

Mailchimp Ecommerce360 Javascript Implementation

javascript,rest,e-commerce,mailchimp

If you mean from client-side Javascript, this isn't possible because the MailChimp API doesn't support CORS and (in most cases) this is a huge security issue. You'll need to communicate with Javascript back to your own servers and have those machines make the requisite API calls.

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

php,rest,security,amazon-web-services,token

After you've got token from the client you need to check two things: validity of the token and its timestamp. There are two scenarios: Make timestamp part of the token: function getToken($timestamp) { return $timestamp . encrypt(getPKey(), $timestamp); } $token = genToken(time()); And then validate it: $token = $_POST['token']; function...

Specify user handlers for JAX-RS when using annotation scanning

rest,annotations,websphere-liberty,apache-wink

I am afraid you can only define this via web.xml file. This is also the way WINk supported. In your case, even if you have @ApplicationPath("rest") defined,you can also have a web.xml.

Google Short URL API: Forbidden

php,rest,google-url-shortener

It seems I need to manually specify the key in the URL $result = file_get_contents("https://www.googleapis.com/urlshortener/v1/url?key=" . $apiKey, false, $context); This now works. There must be something funny with how the API inspects POST for the key (or lack of doing so). Edit: For anyone in the future this is my...

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

scala,rest,future

I think you could do something like: def findAllIssuesByRest(componentKey: String): Future[Seq[Issue]] = // fetch first page fetchIssuePage(componentKey, 0).flatMap { json => val nbPages = extractPagingInfo(json).pages // get the total number of pages val firstIssues = extractIssues(json) // the first issues // get the other pages Future.sequence((1 to nbPages).map(page => fetchIssuePage(componentKey,...

Allow only GET in REST API

rest

inf3rnos comment, even its short is the correct answer: You don't have to allow every HTTP method a.k.a verbs (see list of the standard ones or longer list here) on an entity. I would go even further: I think I never have seen any real life API with all HTTP...

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

java,rest,yaml

According to this article: http://makandracards.com/makandra/24809-yaml-keys-like-yes-or-no-evaluate-to-true-and-false In order to use the strings ‘yes’ and ‘no’ as keys, you need to wrap them with quotes ...

Python Flask persistent object between requests

python,rest,flask,raspberry-pi

The only way to preserve information across requests is to store it somewhere and retrieve it on the next request. Or recreate the object (including state) using parameters passed from the client. For your case, since you'll only be using one Player at any given time, you can make it...

REST API with token based authentication

angularjs,codeigniter,api,rest,token

You can use an API key, however - as you wrote - it's pure protection and easily accessible value - potential abuser just needs to view the source or investigate the queries. In general REST APIs are secured with tokens. At the beginning of the session (not in traditional meaning...

Exclude Package From Gradle Dependency

java,web-services,rest,gradle

I found out that com.sun.jersey:jersey-core:1.19 doesn't bundle the javax.ws.rs class files and instead lists them as a compile-time dependency. Adding this snippet to my build.gradle fixed the issue. configurations.all { resolutionStrategy { // For a version that doesn't package javax.ws force 'com.sun.jersey:jersey-core:1.19' } } ...

Consuming and exposing webservices in one project (.NET)

.net,web-services,rest,soap

If you are trying to enrich the data from one source and combine that with information from another source, I think this is a decent solution. I think it is better to have one single point to talk to (your REST service), than to have two in your application and...

How to make Jersey Unit test for Post method

java,rest,junit,jersey,jax-rs

@Path("hello") public static class HelloResource { @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public String doPost(Map<String, String> data) { return "Hello " + data.get("name") + "!"; } } @Override protected Application configure() { return new ResourceConfig(HelloResource.class); } @Test public void testPost() { Map<String, String> data = new HashMap<String, String>(); data.put("name", "popovitsj"); final String hello...

Django update without required fields

django,api,rest,django-rest-framework

UPDATE is possible via 2 requests: PUT and PATCH PUT updates all the fields of the object on which the operation is to be performed. It basically iterates over all the fields and updates them one by one. Thus, if a required field is not found in the supplied data,...

How To find a WebSocket from a REST bean

rest,jboss,websocket

A Websocket connection starts with a HTTP handshake. On the handshake you also receive cookies (e.g. the session ID cookie) so you get access to the HTTP session. From the JSR 356 Java API for WebSocket spec: Because websocket connections are initiated with an http request, there is an association...

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

json,api,rest,api-design,hateoas

DO include absolute entity URIs in your responses (such as /customers/12 or even http://www.example.com/customers/12). DO NOT include just an entity's ID (such as 12) in a response, because that way you're forcing clients to put together resource URIs themselves. In order to do that, they would need to have prior...

WooCommerce REST API v2: How to process payment?

rest,woocommerce,payment-gateway

As helgatheviking concurred, there currently isn't a way to process payment of an order with the WooCommerce REST API. I ended up writing a hook into the the woocommerce_api_create_order filter that immediately processes the order for payment when the order is created. If the processing fails, then the errors are...

Spring service and Spring web app in one

spring,web-services,rest,spring-mvc,web

yes that is possible to combine with web-app for example your controller package into your restful controller also work that is possible to crud operation via restful web service....

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

php,android,rest,slim

I do the same a few days ago... I do this: Convert image to Base64 (byte array => byte[]) Conver byte[] to String Send String with httpPost to server And this is my code to convert image: public String formatPhoto_JPEGtoByteArray (String uri){ // Read bitmap from file Bitmap bitmap =...

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

rest,azure,azureservicebus

If you want to access an On-Premise service from the Azure service/websites what you need is a Hybrid Connection. For that you will need a BizTalk service to redirect the trafic to your on-prem service. Here are the steps to how to setup a Hybrid connection: https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-get-started/...

Unable to select values from the select list

javascript,jquery,rest

Here is the working fiddle: https://jsfiddle.net/64djszjf/14/ If you take a look at the source js file: https://aui-cdn.atlassian.com/aui-adg/5.8.13/js/aui-experimental.js, there are few lines that sets unselectable class: populateResults: function(container, results, query) { var populate, id=this.opts.id; populate=function(results, container, depth) { var i, l, result, selectable, disabled, compound, node, label, innerContainer, formatted; results =...

unable to convert yaml string to json string using java

java,json,rest,yaml

Indentation is crucial for yaml files. If your yaml file as same as in the question, the output is totally correct. In order to achieve expected json, first you must fix your yaml file. In order to get your expected json output your yaml file should look like this. Singapoor:...

REST-API Different Content-Type on Error Response

java,json,api,rest,spring-mvc

User should always specify what content it's expecting with Accept header. It's you job to return the error that was thrown/caught on the server side in the format that was specified in Accept header. In spring as far as I know it could be achieved with a special mapper. Below...

PHP Multiple cURL requests to REST API stalls

php,rest,cakephp,curl

if you allowed to use external PHP libraries; I'd like to suggest this method: https://github.com/php-curl-class/php-curl-class // Requests in parallel with callback functions. $multi_curl = new MultiCurl(); $multi_curl->success(function($instance) { echo 'call to "' . $instance->url . '" was successful.' . "\n"; echo 'response: ' . $instance->response . "\n"; }); $multi_curl->error(function($instance) {...

@RestController throws HTTP Status 406

java,spring,rest,maven

The issue is with the dependencies that you have in pom.xml file. In Spring 4.1.* version the pom.xml dependency for Jackson libraries should include these: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.4.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.1.1</version> </dependency> You...

How can I get json objects without the object number?

javascript,jquery,json,rest

Create an object. Loop over the array Get the name of each member of the array Copy each member into the object using a property name that is the same as the name you just got Then just use the object instead of the array. You might want to...

Send rest request after async responses volley

android,rest,request,android-volley

put listener for those request for counting the responses(it is either onResponse or onErrorResponse). If count is reached to 3 then send 4th request.

Not able to hit 2nd services with generated Token

c#,web-services,rest,soap,drupal-services

Finally i figured out what was the issue i was creating new cookie container for both the request request.CookieContainer = new CookieContainer(); thus server was unable to authenticate Error was resolved by using this code CookieContainer cookieJar = new CookieContainer(); private void CreateObject() { try { string abc = "";...

Angularjs: View not updating list after POST

javascript,angularjs,rest,resources

I'm not sure if I follow exactly, but I believe you need to deal with a promise from your POST and then push the result. e.g., dataResources.create($scope.newUserData).$promise.then(function(data) { $scope.usersList.push(data); }); Your service will return a promise and then when the POST is complete your service should return the new user...

Erro occur when i POST Request to REST api

ios,xcode,rest

error code 404 means file not fount. your api link not file name exits. please add full api path for example developer.b24solutions.com/grocery/api/rest/yourfilename Because this link not work in browser. You code is correct but incorrect api link. NSURL *myURL = [NSURL URLWithString:@"http://developer.b24solutions.com/grocery/api/rest/giveyourfilenamewithextension"]; ...

ServiceStack Authenticates both iOS Apps when one is logged in

rest,xamarin,servicestack,restful-authentication,servicestack-auth

The issue is because you're using the same Session Cookies with a shared ServiceClient instance which ends up referencing the same Authenticated Users Session. ServiceStack Sessions are only based on the session identifiers (ss-id/ss-pid) specified by the clients cookies, if you use the same cookies you will be referencing the...

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

javascript,jquery,rest,sharepoint

You could first map the TypeOfIssueValue values to a new array and then count each occurence based on this answer. The code would be : var a = data.d.results.map(function(issue) { return issue.TypeOfIssueValue }); result = {}; for (i = 0; i < a.length; ++i) { if (!result[a[i]]) result[a[i]] = 0;...

Laravel: Retrieve polymorphic attributes efficiently

rest,laravel,polymorphism,eloquent

You might be almost there. Your getAvatarAttribute() is way too complicated, indeed. You could try to do something like: /** we hide the relation from the json */ protected $hidden = ['avatar']; /** we append the url of the avatar to the json */ protected $appends = ['avatar_url']; /** *...

Jersey JUnit Test: @WebListener ServletContextListener not invoked

java,rest,junit,jersey,jax-rs

The JerseyTest needs to be set up to run in a Servlet environment, as mentioned here. Here are the good parts: @Override protected TestContainerFactory getTestContainerFactory() { return new GrizzlyWebTestContainerFactory(); } @Override protected DeploymentContext configureDeployment() { ResourceConfig config = new ResourceConfig(SessionResource.class); return ServletDeploymentContext.forServlet(new ServletContainer(config)) .addListener(AppContextListener.class) .build(); } See the APIs for...

AngularJS $resource Custom Action for Requesting a Password Reset

angularjs,rest,ngresource,angularjs-1.3

yes, looks a little bit weird. Instead of GET I will use POST request to reset the password and pass the email param in request body

flask restful: passing parameters to GET request

python,rest,flask,flask-restful

Flask can parse arguments through request from flask import request You can use following lines in the block that requires GET parameters. GET is declared in @app.route() declaration. args = request.args print (args) # For debugging no1 = args['key1'] no2 = args['key2'] return jsonify(dict(data=[no1, no2])) # or whatever is required...

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

javascript,rest,automated-tests,web-api-testing,frisby.js

I fixed using .after() instead .afterJSON().

REST api : correctly ask for an action

api,rest,endpoint

Try to separate API from your application logic. From API you GET the quote and API from now on shouldn't care what you do with that data. The same with marking quotes as favorites. It's your application's and user db's problem how to mark something. Again, API should care only...

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

Well, Both the actions actually means update, where PUT is full update and PATCH is partial update. In case of PUT you already know the identifier of the resource and the resource already exists, so it is not a create and delete action per se. Infact, you can make do...

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

rest,restful-architecture,apiblueprint,apiary.io,apiary

Nothing is wrong with your blueprint. I am afraid the Apiary Mock is rather simplistic and always returns the first response specified (content-negotiation permitting) as default. See "Invoking non-default responses" at Apiary http://support.apiary.io/knowledgebase/articles/117119-handling-multiple-actions-on-a-single-resource to see how to invoke (on demand) another response. Also note there is a proposed syntax in...

Adding authorization to routes

ruby-on-rails,rest,routes,authorization

Do you know the gems rolify and CanCanCan? I think they can help you manage authorizations on resources in a single place instead of having to do it in every controller....

Using .update with nested Serializer to post Image

django,rest,django-models,django-rest-framework,imagefield

As noted in the docs, .update() doesn't call the model .save() or fire the post_save/pre_save signals for each matched model. It almost directly translates into a SQL UPDATE statement. https://docs.djangoproject.com/en/1.8/ref/models/querysets/#update Finally, realize that update() does an update at the SQL level and, thus, does not call any save() methods on...

remote data fetching inside model object in objective c using AFNetworking

ios,objective-c,rest,model-view-controller,afnetworking-2

I dont have anything to say about your MVC(Model–view–controller) correct? I just want to add something that may be useful approach avoiding unwanted crashes.. First is under [[MyAPI sharedInstance] POST:@"auth/" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) { if([responseObject objectForKey:@"id"]) { [[NSUserDefaults standardUserDefaults] setObject:(NSDictionary*) responseObject forKey:USER_KEY]; [[NSUserDefaults standardUserDefaults] synchronize]; result = [responseObject...

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

java,rest,soap

It is just an expression to add enthusiasm. It isn't to mean that other existing web services architecture aren't build for the web. Since REST is a choice implementation for a lot of lightweight(not much extra xml markup, human readable, no toolkits required to build) requirement, it has gotten...

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

Yes, it's totally possible to access endpoints via HTTP requests. The client libraries just help you to generate those requests without having to know the exact URLs. The biggest part where the client libraries help you is for authentication, but if you authenticate with Google and get an access token...

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

python,django,rest

It looks like you are hitting issue 2969. It should work if you upgrade from Django 1.6 to 1.6.11. However, please note that 1.6 is now end of life and does not receive security fixes, so ideally you should upgrade to 1.7, or even better, the new 1.8 LTS.

Asp.net Web API Routing by action name fix

asp.net-mvc,rest,asp.net-web-api,asp.net-routing

The article provides a sample on how to configure routing. These last two samples are just for illustrative purposes, it is more like pseudo-code, not a working code. If you are just starting with C# these last code samples are confusing. The errors that you are getting clearly describe what...

LinkedIn Group API changes

api,rest,group,linkedin

There is no way to access that API publicly any longer. You would need to apply to be part of their partner program to get access to those endpoints once again: https://developer.linkedin.com/partner-programs/apply...

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

c#,.net,json,wcf,rest

It sounds like the Result is actually a textual representation of the byte array, rather than actually containing an array of bytes. Have you had a look at the raw JSON to see what is in Result? If it's actually textual (either hexadecimal or base64) you will need to simply...

RestFul web service which reads properties file

java,rest

There are few ways to do this the one way of doing it is to make the props_load a private static member of the class and call it like this public class SendEmailUtility { private static Properties props; private static Properties getProperties() { if (props == null) { File configDir...

AJAX call not failing or succeeding

jquery,ajax,json,rest,jsonp

What version of jQuery are you using? Later versions of jQuery use error instead of failure. I ran your code, and it said the client blocked the request....