Spero non vi sembri troppo sciocca la domanda ma, d'altra parte, io di java veramente non ne capisco un tubo.
Stò utilizzando (leggi copia e incolla) delle API Live Contact.
Il codice java è il seguente:
codice:
<script type="text/jscript">
WL.init({
client_id : "",
redirect_uri : "",
scope: "wl.signin",
response_type: "token"
});
WL.login({ scope: "wl.contacts_create" }).then(
function(response) {
createContact();
},
function(response) {
log("Could not connect, status = " + response.status);
}
);
function createContact() {
var contact = {
first_name: "William",
last_name: "Flash",
preferred: "franco@gmail.it"
};
WL.api({
path: "/me/contacts",
method: "POST",
body: contact
}).then(
function(response) {
log(JSON.stringify(response).replace(/,/g, ",\n"));
},
function(response) {
log("Cannot create contact: " +
JSON.stringify(response.error).replace(/,/g, ",\n"));
}
);
}
function log(message) {
var child = document.createTextNode(message);
var parent = document.getElementById('JsOutputDiv') || document.body;
parent.appendChild(child);
parent.appendChild(document.createElement("br"));
}
</script>
Dall'esempio vengono inseriti in rubrica first_name e last_name. Io dovrei inserire anche l'email. Considerando che la risposta dopo l'inserimento è la seguente:
{"first_name":"William", "last_name":"Flash", "name":"William Flash", "is_friend":false, "is_favorite":false, "user_id":null, "email_hashes":[], "updated_time":"2014-03-18T21:42:07+0000", "birth_day":null, "birth_month":null, "work":[], "emails":{"preferred":null, "account":null, "personal":null, "business":null, "other":null}, "addresses":{"personal":{"street":null, "street_2":null, "city":null, "state":null, "postal_code":null, "region":null}, "business":{"street":null, "street_2":null, "city":null, "state":null, "postal_code":null, "region":null}}, "phones":{"personal":null, "business":null, "mobile":null}}
secondo voi come faccio a impostare la variabile:
io ho fatto diversi tetativi, tra i quali quello che mi sembrava ad occhio il più corretto era il seguente:
codice:
var contact = {
first_name: "William",
last_name: "Flash",
emails: {
preferred: "franco@gmail.it"
}
};
Spero tanto che qualcuno possa aiutarmi. Grazie