I want to use GAE datastore to store my data but instead of the java API we want to use the JSON API and making requests through spray.
But before I can even do any request I need to obtain an access token.
I can't figure out how this is done with either the Java API or any other means. Is there a way to obtain an access token which can then be used for the JSON API (through spray)?
Like many Google services, the Datastore API uses OAuth for authentication. The easiest way to use it is with one of the Google API client libraries.
Java: https://developers.google.com/api-client-library/java/
Java + Datastore: https://developers.google.com/api-client-library/java/apis/datastore/v1beta2
The documentation for the client does a pretty good job of explaining how OAuth works and how to get started calling APIs by registering your app with the Console.
(I'm not familiar with spray, but I assume you'd be able to use the Java client from Scala.)
Related
I am trying to connect from Java to the Sharepoint Online REST API.
I previously used a SharepointOnline ADD-IN registered directly in the Sharepoint system that has permissions to all the site collections (FullControl).
I got the token with the app credentials from the url:
https://accounts.accesscontrol.windows.net//tokens/OAuth/2
I can make requests to the Sharepoint REST API directly
Now I have to switch to an Azure registered app.
The code is written in Java and I use the Azure sdk-com.microsoft.azure (artifactId-azure). I can successfully retrieve a token, but this is not valid for later requests to the Sharepoint REST API.
I get this error:
'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."
Is there any possibility to get a valid token for Sharepoint REST API requests?
Yes this is possible. Check out the below document:
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread
When using SharePoint Online you can define applications in Azure AD and these applications can be granted permissions to SharePoint, but also to all the other services in Office 365. This model is the preferred model in case you’re using SharePoint Online, if you’re using SharePoint on-premises you have to use the SharePoint Only model via based Azure ACS as described in here.
Hope this helps!
You can take a look of this project i've develop (and i'm currently working on it on my free time) where you have a working implementation of a java API to communicate with sharepoint rest api v1 and perfom common operations (rest api is still not fully covered but has most common operations and also provides a starting point with working examples). You can take a look of it at
https://github.com/kikovalle/PLGSharepointRestAPI-java
I am currently using Bitrix24 for HR management and task management.
Since it provides an option to integrate third party applications with it, I am stuck in how to implement OAuth for my application with Bitrix.
I went through documentation provided by Bitrix24 but it uses php code.
Is there any sample JAVA code available for OAuth implementation?
Unfortunately havent seen any examples on other that PHP languages, but
if you are already experienced with Java it should not be a problem.
In case you are working with bitrix24 cloud edition - you need to
1) create application for marketplace using you partner account and obtain secret key and application id
2) send this secret key and application id from your application written on any language and receive
3) receive request token and refresh_token and use them to access rest api provided by Bitrix24 https://training.bitrix24.com/rest_help/
more details on what kind of request you need to do: https://training.bitrix24.com/rest_help/oauth/examles.php
hope this help you.
You can use API like this for JAVA
I am adding LEADS from the API, and updating the same LEAD
to add the LEAD:-
Method: POST
URL:-
https://.bitrix24.com/rest/crm.lead.add
Parameters:-
{"fields[TITLE]":"LEAD_TITLE","auth":"AUTH_TOKEN"}
It will add the new LEAD in you Bitrix Dashboard.
I'm using a Trade Me API. Which requires OAuth access tokens according application registered with it. So i have got OAuth access tokens. I have URL of API, all the parameters and values. But I don't understand how to get started. It is obvious that I need to use access tokens but don't understand where and how to use them. As we cant pass them into URL.
I'm using this API :
http://developer.trademe.co.nz/api-reference/my-trade-me-methods/retrieve-your-sold-items/
At the bottom of the API documentation page you provided in your question, there is a Request Builder. This allows you to generate an API request by filling in the form provided and clicking Send Request.
If you were to capture the HTTP requet generated by the browser when you submit this form using an application such as Fidler, you could determine the correct format for the request, and then generate similarly formatted requests from within your own application.
You might also want to check out the OAuth page of the Trade Me Developer API reference which explains how OAuth authentication should be performed for the Trade Me API
Sorry I can't be of more direct assistance, as I'm not a Java developer.
first poster :)
As the title says, I am looking to create a desktop app which will notify me of changes on facebook and new emails, and the facebook part (the first part I've tried) is baffling me. I've never worked with an api before, and have no idea how to integrate facebook's api with this desktop helper I want to create. I will be using java to create this desktop helper.
Thanks in advance!
Here are few pointers for you to get started. Please feel free to ask for clarifications and I will edit my answer accordingly:
For facebook, you can actually pull all those info via their API. There are a lot of types for API, but Facebook specifically use REST API over http.
To simplify, think of it as making an http call with specific parameters and you will be getting an output back.
In order to use facebook API you need to understand their protocol including authentication/login and how to request for things that you want. This would require some reading to their documentation which is pretty complete and available at http://developers.facebook.com/docs/.
For the description of their API URL and the input/output documentation, you could directly jump to Graph API Documentation http://developers.facebook.com/docs/reference/api/.
In order to call their API via HTTP from Java, you could leverage HttpClient library from Apache Http Components project http://hc.apache.org/. They have plenty of tutorial and examples for how to make http call using HttpClient
For combining with all other emails accounts (per your question), you need to deal with SMTP or IMAP (whichever email protocol that you are planning to combine with Facebook). This is already built-in to Java via their Java Mail API collection
You then can poll this data on interval basis to get an update from Facebook and your mails
Once you have figured out how to get the data, the rest is just following a good MVC framework. That means separating out your presentation, data and controller (application logic). Make sure that you are separating the classes for #1 and #2 and each of them put their data to normalized data format that then get feed to your View (presentation layer)
I am new to appengine. I will write application which consist of two parts.
1) Core written in app engine with REST interface for clients.
2) Client application written in J2EE on my other (not appengine) server. But here, client may use any other technology (android, swing etc.)
I dont know, how to handle authentication of users in this schema. I think that I am in the middle between standard login and installed applications.
The simplest solution that occured to me, that the client will request username+password, pass it to appengine application via https and it will authenticate.
But dont know how to synchronized the login with client app, because it will need also data from google applications...
Is there any solution or pre-prepared facility in Java how to handle this?
Thanks
You probably want to use OAuth for this; client login or using username+password is not a good way to do this, and informed users will be -- or SHOULD be -- hesitant to give away their passwords. There is a page for using OAuth within AppEngine applications written in Java which may be of use. There is also some support for Oauth in the GData client library for Java. The OAuth in the Google Data Protocol Client Libraries document may help you to understand how to use those features.