How to post STATUS UPDATES on LinkedIn via its api? - linkedin

Right now, I am using a library java library:
<dependency>
<groupId>com.googlecode.linkedin-j</groupId>
<artifactId>linkedin-j-core</artifactId>
<version>1.0.429</version>
</dependency>
bUT this does not work anymore. I the library is using deprecated API :
/v1/people/~/current-status
and whenever ran it throws exception as follows:
Exception in thread "main" com.google.code.linkedinapi.client.LinkedInApiClientException: Unsupported PUT target {/v1/people/~/current-status}
So I look-up at LinkedIn documentation for new updates, BUT could NOT find the appropriate documentation for publishing user current profile status...
https://developer.linkedin.com/documents/profile-api
Current code that stopped working is similar as follows using LinkedInJ:
LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance(getApiKey(), getSecretApiKey());
LinkedInAccessToken accessToken = new LinkedInAccessToken(promotion.getAccessToken(), promotion.getSecretAccessToken());
LinkedInApiClient client = factory.createLinkedInApiClient(accessToken);
client.updateCurrentStatus("my status message");
How to post STATUS UPDATES on LinkedIn via its api?

Read your own question.
I the library is using deprecated API :
deprecated means that it is no longer supported, which is concurrent with the error message you're receiving:
Unsupported PUT target {/v1/people/~/current-status}
This means that the deprecated lib you're using has a function updateCurrentStatus but under the covers the API endpoint the request is being made to doesn't support the PUT verb.

To get rid of that error you need to add the linked-j jar in your build path. Here is the link to download the jar http://www.java2s.com/Code/Jar/l/Downloadlinkedinjjar.htm
My issue was solved after adding the jar.

Related

xamarin.forms: ios cannot create async on firestore. failing with with "bad gRPC response"

I created an empty xamarin forms project and followed the path to connect to the database. I am able to connect with the right key store file but as soon as I try to create data on the server I am getting a bad grpc response.
It look like ios is calling with http 1.1, but google requiers 2.0.
This is the line that fails:
await docRef.SetAsync(user);
This is the error I am getting:
e {Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Bad gRPC response. Response protocol downgraded to HTTP/1.1.") at Google.Api.Gax.Grpc.ApiCallRetryExtensions+<>c__DisplayClass0_0`2[TRequest,TResponse].<WithRetry>b__0 (TRequest request, Google.Ap…}
I am stuck here for days now, please help.
The same code works fine on android devices, its just iOS problem in xamarin.forms.
EDIT:
I have noticed, that this issue does not exist on the firebase nuget package 3.2.1 and below. Just the higher ones throw this error.

Is there any alternate way to add and edit an outlook ToDo task without using GraphServiceClient in Xamarin forms application

We are trying to update an outlook Task by using GraphServiceClient of Microsoft.Graph aPI (beta version) as -
await AuthenticationHelper.GraphClient.Me.Todo.Lists[taskToDO.Id].Tasks[task.Id]
.Request()
.UpdateAsync(todoTask);
but when we update it we get this error -
Status Code: BadRequest
Microsoft.Graph.ServiceException: Code: UnsupportedApiVersion
Message: The HTTP resource that matches the request URI 'https://outlook.office.com:444/todob2/graph/v1/users('...')/todoApp/lists('... ')/tasks' does not support the API version '1.0'.
Inner error:
Message: No route providing a controller name with API version '1.0' was found to match request URI 'https://outlook.office.com:444/todob2/graph/v1/users('...')/todoApp/lists('... ')/tasks'.
How to sole this issue ? Is there any alternate way to add and edit an outlook ToDo task without using GraphServiceClient ?
Can you try to update the same task from Graph explorer https://developer.microsoft.com/en-us/graph/graph-explorer. The API can be used for same is https://graph.microsoft.com/v1.0/me/todo/lists/{list-id}/tasks/{task-id}
In your request url, it seems that task-id is not present which is causing this issue.
Also, can you please also share the request-id being returned as part of failure response? We can debug this issue.

Xamarin.Forms: How to request ACCESS_BACKGROUND_LOCATION?

Using XF 5.0.0 and Essentials 1.7.0. Targeting Android 11.0, API 30.
I'm already requesting ACCESS_FINE_LOCATION because I use Plugin.BLE.
I've added Microsoft.AppCenter.Analytics to my XF app, and that seems to require the ACCESS_BACKGROUND_LOCATION permission (the app crashes & an exception tells me so).
There's no item for ACCESS_BACKGROUND_LOCATION in the Project Properties / Required Permission list, so I manually added it to AndroidManifest.xml. It compiles, but still crashes.
I've also read that you can't request both ACCESS_FINE_LOCATION and ACCESS_BACKGROUND_LOCATION at the same time, that _FINE must be granted first, then you must request _BACKGROUND. Is that true?
Additionally, I'm requesting LocationAlways programatically:
var status = await Permissions.RequestAsync<Permissions.LocationAlways>();
because it seems you can't do that one in the manifest.
And I'd be fine with requesting Background Location programatically, but Xamarin.Essentials.Permissions doesn't offer that.
So I'm stumped!
Does anyone know how to request both ACCESS_FINE_LOCATION and ACCESS_BACKGROUND_LOCATION in a Xamarin.Forms app?
Thanks!

does "app_key" means the same as "app_code" for HERE geocoding credentials on Python?

I am trying to geocode some addresses with python
so I created a freemium account on https://developer.here.com
my code is this
(...)
here = Here(here_config.app_id, here_config.app_code, timeout=5)
here.geocode(string_to_geocode)
I am getting the following error message:
HTTP Error 401: Unauthorized
my doubt comes from the difference between the terms "app_code" on my code sample and "app_key" on my credential screen.
Is there another step I need to do in order to get a "app_code" or is my "app_key" already supposed to be it?
P.S. on that same screen Here provides me an option of getting JAVASCRIPT keys, HERE SDK FOR IOS (PREMIUM EDITION) [this option cleary has a button that says "generate app_key and app_code", however, I am not developing a cellphone app, but a python program.
What am I missing ?
here_credential_screen
App ID and App Code have been replaced. We encourage all users to switch to API Key or OAuth 2.0 (JSON Web Tokens) authentication. Please be aware that as part of adapting to the new authentication method, some endpoints have also changed.
please check the new domains here
You can either use your ApiKey or App_Id/App_Code.
for example like this-
https://geocoder.ls.hereapi.com/6.2/geocode.json?apiKey={YOUR_API_KEY}&searchtext=425+W+Randolph+Chicago
https://developer.here.com/documentation/geocoder/dev_guide/topics/quick-start-geocode.html

Stripe webhook versioning exception in test mode

I am trying to test to send a charge.succeeded webhook to my endpoint but there's an error:
Received event with API version 2019-03-14, but Stripe.net 24.5.0 expects API version 2019-02-19 and when adding webhook in test mode you can only choose 2019-03-14 or 2018-11-08 version.
Obviously I'm using Stripe.net 24.5.0, I can't test my webhook because of this.
Does anyone have any idea how to fix this? Thank you.
Did you perhaps hardcode the API version to "2019-02-19" in your application?
You can downgrade your API key version to "2019-02-19" but you'll have to write into Stripe support to do that: https://support.stripe.com/contact
Update: I found the answer here.
You just need to set the throwOnApiVersionMismatch to false and it will not check the version if it's not the same.
sample code:
var event = EventUtility.ConstructEvent(
JSON,
Request.Headers["Stripe-Signature"],
_secret,
300,
(long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds,
false);
EDIT: As stated by karllekko and in the link it is much safer to create a WebhookEndpoint with the API version forced to the same API version as the library, this can only be done via API and not in the dashboard.
Delete your current webhook and create a new webhook with the same url, but change the API version. Stripe 24.5.0 expects API version 2019-02-19 but you are supplying the default API which is 2018-11-08 in the webhook - which will throw an error.
Change to the required API and test your webhook again. This also goes for future API releases - be sure to use the latest API if you experience this error.

Resources