I'll be adding the ability to the orcid-java-client (https://github.com/TomDemeranville/orcid-java-client) at some point soon too if that's any help. It'll currently append works but not create complete profiles. It'd be a quick job to add it I think.
I've not used CURL from PHP for a while now but perhaps if you post up the code and errors we'll be able to help.
Tom.
--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/orcid-api-users.
For more options, visit https://groups.google.com/groups/opt_out.
For more options, visit https://groups.google.com/d/optout.
Tom.
The information contained in this e-mail is confidential and may be legally privileged. It is intended for the addressee(s) only. If you are not the intended recipient, please delete this e-mail and notify thepostm...@bl.uk : The contents of this e-mail must not be disclosed or copied without the sender's consent.
The statements and opinions expressed in this message are those of the author and do not necessarily reflect those of the British Library. The British Library does not take any responsibility for the views of the author.*****************************************************************************************************************Think before you print
--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email toorcid-api-use...@googlegroups.com.
private static final String SANDBOX_LOGIN_URI = "https://sandbox.orcid.org";
private static final String SANDBOX_API_URI_TOKEN = "https://api.sandbox.orcid.org";
private static final String SANDBOX_API_URI_V1_1 = "http://api.sandbox.orcid.org/v1.1";
I've added a method to get the token but I'm getting 401 unauthorised for some reason. This seems to happen with both the live and sandbox APIs. Not sure if you can tell why? Perhaps my account isn't authorised but yours is...
/** Fetch an access token that enables the creation of ORCiD profiles
*
* @return
* @throws IOException
*/
public OrcidAccessToken getCreateProfileAccessToken() throws IOException{
Reference ref = new Reference(apiUriToken + TOKEN_ENDPOINT);
ClientResource client = new ClientResource(ref);
Form f = new Form();
f.add("client_id", clientID);
f.add("client_secret", clientSecret);
f.add("acope", OrcidAuthScope.CREATE_PROFILE.toString());
f.add("grant_type", "client_credentials");
Representation rep = client.post(f, MediaType.APPLICATION_JSON);
String json = rep.getText();
OrcidAccessToken token = new ObjectMapper().reader(OrcidAccessToken.class).readValue(json);
return token;
}
Tom.
-- Andrew Cockbill Chief Data Officer Symplectic Ltd. Tel: 020 7418 5555 and...@symplectic.co.uk