Commit be412ccf36313425cdea44a194851442b698341e

Authored by Paulo Graça
1 parent bf0a167bf1

changes in text

Showing 1 changed file with 28 additions and 21 deletions   Show diff stats
README.md
... ... @@ -138,11 +138,12 @@ Then you should have a landing page in your project, configured in redirectUri t
138 138  
139 139 if you already have a token, you could simply use setAccess_token method in the OrcidAccessToken object:
140 140  
  141 + OrcidAccessToken orcidToken = new OrcidAccessToken();
141 142 orcidToken.setAccess_token("d3c1edb9-5385-4b76-af77-e3cd9889c5ec");
142 143  
143 144 ## Get activities
144 145  
145   -To access Activities the token must be associated with the scope ORCID_PROFILE_READ_LIMITED
  146 +To access Activities the token must be associated with the scope /orcid-profile/read-limited
146 147  
147 148 try {
148 149 ActivitiesSummary activities = orcidClient.readActivitiesSummary(orcidToken);
... ... @@ -176,6 +177,8 @@ To access Activities the token must be associated with the scope ORCID_PROFILE_
176 177  
177 178 ## Update a Work
178 179  
  180 +To update a work the token used must be associated with one of the scopes: /activities/update or /orcid-works/update
  181 +
179 182 try {
180 183 String putCode = "477804";
181 184  
... ... @@ -194,27 +197,30 @@ To access Activities the token must be associated with the scope ORCID_PROFILE_
194 197  
195 198 ## Create a new Work
196 199  
  200 +To create a new work the token used must be associated with one of the scopes: /activities/update or /orcid-works/create
  201 +
  202 + Work newWork = new Work();
  203 +
  204 + // Set the title
  205 + WorkTitle workTitle2 = new WorkTitle("new item PTCRISSync",null,null);
  206 + newWork.setTitle(workTitle2);
  207 +
  208 + // Set the type
  209 + newWork.setType(WorkType.JOURNAL_ARTICLE);
  210 +
  211 + // Set External ID (ORCID API requires at least one)
  212 + ExternalIdentifier internalId = new ExternalIdentifier();
  213 + internalId.setExternalIdentifierType(ExternalIdentifierType.SOURCE_WORK_ID);
  214 + internalId.setExternalIdentifierId("PTCRIS_01");
  215 + // You must indicate the Relationship or the External URL
  216 + internalId.setRelationship(RelationshipType.SELF);
  217 +
  218 + // Set the External Identifiers
  219 + WorkExternalIdentifiers externalIdentifiers = new WorkExternalIdentifiers();
  220 + externalIdentifiers.getWorkExternalIdentifier().add(internalId);
  221 + newWork.setExternalIdentifiers(externalIdentifiers);
  222 +
197 223 try {
198   - Work newWork = new Work();
199   -
200   - // Set the title
201   - WorkTitle workTitle2 = new WorkTitle("new item PTCRISSync",null,null);
202   - newWork.setTitle(workTitle2);
203   -
204   - // Set the type
205   - newWork.setType(WorkType.JOURNAL_ARTICLE);
206   -
207   - // Set External ID (ORCID API requires at least one)
208   - ExternalIdentifier internalId = new ExternalIdentifier();
209   - internalId.setExternalIdentifierType(ExternalIdentifierType.SOURCE_WORK_ID);
210   - internalId.setExternalIdentifierId("PTCRIS_01");
211   - // You must indicate the Relationship or the External URL
212   - internalId.setRelationship(RelationshipType.SELF);
213   -
214   - // Set the External Identifiers
215   - WorkExternalIdentifiers externalIdentifiers = new WorkExternalIdentifiers();
216   - externalIdentifiers.getWorkExternalIdentifier().add(internalId);
217   - newWork.setExternalIdentifiers(externalIdentifiers);
218 224  
219 225 //The method addWork will retrieve the PUTCODE
220 226 String newPutCode = orcidClient.addWork(orcidToken2, newWork);
... ... @@ -227,4 +233,5 @@ To access Activities the token must be associated with the scope ORCID_PROFILE_
227 233  
228 234  
229 235 # License
  236 +
230 237 Please contact us.
231 238 \ No newline at end of file
... ...