Why am I getting 401 UnauthorizedError when getting a list of events using the SocialTables API? - social-tables

I am trying to use the API Console to get access to event information. When I use https://api.socialtables.com/4.0/events/ I get a 401 response code, where I expect to see a list of events that I have created.
I am the owner on the account, and other calls in the API Console are working. I can query https://api.socialtables.com/4.0/users/ with my user id and https://api.socialtables.com/4.0/accounts/ with my account id.
I get the same behavior when calling the API from Postman.
Update
I was able to find my team id by inspecting the URL. It appeared to be an legacy numeric id, so I tried one of the legacy endpoints:
https://api.socialtables.com/4.0/legacyvm3/teams/[TEAM-ID]/events
That works, and returns the list of events that I expected. However, it only returns the legacy id values. I'd prefer to strictly use the newer ids and API endpoints.

Thanks for using our API. I couldn't reproduce the 401 unauthorized issue, but I noticed our trial signup put you in the 3.0 version, which is why you see your 3.0 events. Our trial process is currently being revised to put people in our latest version, and will do that soon.
In the meantime I went ahead and migrated your account to 4.0 and created a test v4 event.
Using this curl gives me the expected result:
curl --request GET \
> --url https://api.socialtables.com/4.0/events \
> --header 'authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXade8'
If you have further questions I'd be happy to assist.

Related

LinkedIn API App - "Resource search does not exist"/"Empty oauth2 access token"

I am working on a simple searching app using LinkedIn's API.
I have set my base-url for the LinkedIn Sales Navigator to:
base_url = "https://api.linkedin.com/v2/search"
I have also obviously added my client_id, client_secret, and access_token in the headers.
However, upon running the program, I am getting the error:
{"serviceErrorCode":0,"message":"Resource search does not exist","status":404}
This makes me think that there is a problem with the base-url. But then, upon visiting the link my program is trying to visit, I am met with a JSON that says:
serviceErrorCode 65604 message "Empty oauth2 access token" status 401
However, as far as I am concerned, I have gone through the OAuth2 flow correctly and in full.
But I'm not sure what it actually is.
Any ideas?
Thanks in advance.
this search point is depreciated. this is allowed to the selected developer only. First, make sure that you have the permissions for that. For reference, you can visit this link
The other thing, if you have permission, then you need to pass the bearer token in the header for authorization.
curl --location --request GET 'https://api.linkedin.com/v2/search' \
--header 'Authorization: Bearer {INSERT_TOKEN}' \
The complete information can be found here.

How to get a list of users who logged in after a certain date via YouTrack API?

I need to get a list of users who logged in within the last 2 years. YouTrack Web interface shows me 141 users on /admin/hub/users?query=lastAccess(after:%202018-01-01)
But when I try to get the same list via API, I get an empty array. What am I doing wrong?
Here's my API request:
curl -X GET "https://[my_youtrack_URL]/api/admin/users?query=lastAccess(after:%202018-01-01)&$skip=0&$top=200"
What am I doing wrong?
You're missing an authentication token.
Try adding the following to your curl command -H "Authorization: Bearer mytoken123". The token itself can be created in your YouTrack user profile.
I got the answer from the YouTrack developers, it's two-fold:
1) First, the endpoint for request concerning users is different - this is a "hub" feature, so the endpoint should be /hub/api/rest/users (as also mentioned by #Jk1 above).
2) Second, the correct syntax for the query is lastAccess(after:+2018-01-01) (+ instead of %20).

How to get fullAccountNumber in Yodlee

Calling the /accounts/{accountId} endpoint with the include fullAccountNumber returns an error Y821 - fullAccountNumber not supported.
I'm doing:
curl -i -H "Api-version: 1.1" -H "Authorization: Bearer {token}" -X
GET https://production.api.yodlee.com/ysl/accounts/{accountId}
?container=bank&include=fullAccountNumber,holder,profile
Note: the line breaks are just for readability
How do you get fullAccountNumber?
It looks like you are calling the API correctly. This feature needs to be enabled for your account, after approval from the Yodlee Security Office. You can make an application through your account manager.
The error message should be updated to something more helpful, like “fullAccountNumber feature is not enabled for account. Please contact Yodlee support.”
Circling back to this because it's been more than a year and want to have a solution:
This was not possible with Yodlee and we went with a different solution.

How to use Google sheets REST API directly to create a sheet

I have a PHP application which, unfortunately, already uses the 1.1.4 version of the Google Client API, and I am unable to change that, which makes the 2.X version of the Google PHP Sheets API unavailable to me.
However, I'm hoping to be able to use the Google Sheets REST API directly, making my own curl calls (using Guzzle if that's at all interesting).
I'm brand new to the Google API and I've been all over their documentation, but I haven't been able to figure out how to do some basic things.
For the purposes of this question I want to simply create a new Google spreadsheet via the API, from a tool like POSTman.
I get that I first have to obtain an OAuth2 token via https://www.googleapis.com/auth/spreadsheets. The problem is that I can't quite figure out what to pass this call. I'm assuming it requires a GET since POST returns an error saying that method is unavailable.
Once I get that token, how do I use it when I POST to https://sheets.googleapis.com/v4/spreadsheets
Can someone provide a very basic example of the calls I might make directly to simply create a very basic default spreadsheet?
Or am I thinking about this all wrong? All help is appreciated.
If you already have an OAuth2 access token, you can pass it in the "Authorization" header:
curl -L -d '{}' \
-H "Authorization: Bearer <INSERT ACCESS TOKEN HERE>" \
-H 'Content-Type: application/json' \
https://sheets.googleapis.com/v4/spreadsheets
I just verified that curl command creates a new sheet.
Unfortunately as you already indicated, that's probably the simple part, and Getting an OAuth2 access token is more challenging.
Here's a (relatively painful, unfortunately) approach I use sometimes:
You should first create your own project in the API Console or Cloud Platform console, and configure it for your own OAuth2 client id and client secret.
Next, for just playing around, from the Google OAuth2 Developer Playground at https://developers.google.com/oauthplayground/, set your Client Id and Client Secret under the "OAuth 2.0 configuration" (it's the Settings icon - the little gear in the top right). The places to enter those will be hidden until you check "Use your own OAuth credentials". You can then get an access token, with the scopes https://www.googleapis.com/auth/spreadsheets and https://www.googleapis.com/auth/drive, by following the steps on the left.
For more playing around, you could then construct the POST right in step 3, or use the access token from Step 2 in the curl command above.
Best of luck - it's tricky stuff to get the auth parts right. There are lots of moving parts, and I'm just illustrating the high points here.
Tragedy about the library issue -- the PHP Quick Start appears to deal with the auth relatively cleanly.
Tim
Here's the official spreadsheets.create reference. Here's a list of Sheets API Samples. I would suggest that you leave the current version you're using and play with the PHP Quickstarts just so you can have a grasp of how it works.
This is going to be less than satisfying, but after fighting with it a while I looked to see if I could go against the premise of my question: That I couldn't upgrade to the latest Google Sheets PHP API.
As it turns out there was a way. That made all of this a lot easier.
Google's documentation is frustratingly incomplete, but I managed to get it all working anyway. Both of you gave me key pointers. Thanks for your help.

How to make Twitter API call through curl in unix

I would like to pull the data from Twitter REST API. I have created the consumer key, secret and Access token, secret. I have tried with "Test OAuth", it generates a CURL command but if I change any one parameter then it is giving the below error.
Message: {"errors":[{"code":32,"message":"Could not authenticate you."}]}
Now I would like to call the twitter API using CURL in shell script for different screenNames.
I want a sample command some thing like mentioned below
curl --get 'https://api.twitter.com/1.1/statuses/user_timeline.json' --data 'count=2&screen_name=aswin' APIKEY:"xxxxxx",Acesstoken:"yyyyyyyy"
Thanks in advance.
Regards,
Aswin
I found the answer.
curl --get 'https://api.twitter.com/1.1/statuses/user_timeline.json' \
--data 'count=2&screen_name=twitterapi' \
--header 'Authorization: OAuth oauth_consumer_key="AAAAAAAAAAAAAAAAAAAA", oauth_nonce="BBBBBBBBBBBBBBBBBBBBBBB", oauth_signature="CCCCCCCCCCCCCCCCCCCCCCCCCCC", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1471672391", oauth_token="DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD", oauth_version="1.0"'
Since your specific query doesn't require a user context you can use Application only authentication to make this request. The bearer token won't change per request so it should allow you to keep using curl.
https://dev.twitter.com/oauth/application-only
n.b. it won't work for all endpoints, but should for the case you listed.
Because most twitter requests require calculating the oauth signature, you should either write a client yourself or reuse an existing command line client.
https://github.com/twitter/twurl
https://github.com/sferik/t
https://github.com/yschimke/oksocial/wiki (Mac focused/cross service)
As you saw any change to the request will generally invalidate the query, and even time is one of the inputs.