mercredi 22 avril 2015

POST using jersey not converting JSON to JAXBObject in REST service

I am writing a POST rest API service , and my service class is

@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response produceJSON(Student student) {

    System.out.println("===============" + student.getFirstName());

    return Response.ok().build();

I am using DEV HTTP Client and sending XML request with complete student object and it is working fine. But when I am sending JSON request with student object , it provides me a student object with all null values. student.getFirstName() is coming as null , though I am setting this value. Any solutions ?

Bing translator API for android can give more than 1 result?

I'm making a Translator for Thai to English, one Thai word can translate to many words in English,so can I do that in my app?

I just research about example for this api but cant find solution.

I found it use a array of string to get results but this method just use for sentence translate

How can I authorize API access with just a Phone number and SMS Pin?

I'm creating a backend that has a REST API that will be consumed from an mobile app. Because the app is mobile only we're not using an email and password to create account/login but instead a phone number and then they receive a pin number with an SMS message to confirm they own the number.

After I confirm the user is who they say they are with the pin number, how should I go about authenticating future API requests?

My first thought was to create a token and return it to the app. My second thought was to use OAuth but then i'm getting confused as to which method would work with the Phone number/SMS login method (2/3 leg, grants, etc..). I don't fully understand how this might work when using OAuth with our own apps (as opposed to OAuth with another provider). The token seems like the easier route.

If I use the token, is it bad to use the same token until the user is logged out? (over https). I'm assuming it's worth the extra work to make them expire a little longer than the avg. user session.

Unfortunately it doesn't seem to be a turn key solution that works with phone numbers. I'm using Meteor but am expecting to roll my own with Node modules (by exposing connect on the Meteor server).

Any help is greatly appreciated!

Get expired domains API

I have been searching high and low for a reliable (semi) accurate API to integrate with for checking expired domains and their availability. I've seen domainsbot and domainr and a couple others, but they are a little outdated in regards to reliability.

Anyone have any suggestions in regards to where I could find an API to access?

How to get list of softlayer's operatingSystemReferenceCode?

I am using softlayer api using the Java implementation to create multiple VMs from different locations with different operating systems.

But I need a way to know the list of available operatingSystemReferenceCode and Datacenter code.

Track likes on my photos with instagram API

I would like to track the number of likes on photos that I post to instagram via the python-instagram module using the instagram API.

how do i fix nexmo text messages with + sign

i have this text message: Im using Laravel 4.2.

Im using Nexmo API Library Made for Laravel:


    $from = "MyCompany";
    $to   = "09096448797";
    $text = "Confirmation Code: 55555";

    Nexmo::sendSMS($from, $to, $text);

When i received message, i get this:

Confirmation+Code%30A+55555[NEXMO DEMO]

Somehow its replacing the special characters. spaces, semi colon.