No such host is known (api.smartsheet.com) - Java SDK - smartsheet-api

Trying to get sheet data using the smartsheet java sdk. This is the code I am using -
Smartsheet smartsheet = new SmartsheetBuilder()
.setAccessToken(accessToken)
.build();
smartsheet.setAssumedUser(emailAddress);
smartsheet.sheetResources().getSheet(sheetId, null, null, null, null, null,null, null);
This is the error I am getting -
java.net.UnknownHostException: No such host is known
(api.smartsheet.com)
When I make a get request on postman using the same access token it works.

I don't know much about Java, but based on a bit of research I'd suspect you may be getting that error due to your internal proxy. According to the (accepted) answer in this other Stack Overflow post, you can setup a proxy in the Smartsheet Java SDK by using the same process that Smartsheet's QR Code sample uses.

Related

Generate Token using the Flutter Application - Agora

Is there any way to generate a Token from Flutter application and then validate it?
I tried passing null in Token parameter of AgoraRtcEngine.joinChannel(null, widget.channelName, null, 0); but it is showing black screen for the Audience
Already gone through:
https://github.com/AgoraIO-Community/Agora-Flutter-Quickstart
https://docs.agora.io/en/Real-time-Messaging/token_server_rtm
and other official docs but there's nothing to help in Flutter.
Any help would be appreciated :)
A token needs to be generated using your own server irrespective of the platform you're using. You can have a look at this guide that explains how to build your own server: https://www.agora.io/en/blog/how-to-build-a-token-server-using-golang/
You can have a look at this gist that explains how to use tokens in your Flutter code:
Using tokens - https://gist.github.com/Meherdeep/25d4bdac5dad0c4547809754c9e8417e
Renew tokens - https://gist.github.com/Meherdeep/088c5700f141d27b5e849d466c2358fb

flask-jwt-extended - Catch raise RevokedTokenError('Token has been revoked')

I already tried reading the documents as well try out the changing default behaviors https://flask-jwt-extended.readthedocs.io/en/latest/changing_default_behavior.html to handle the error (the link shows how to handle expired token) and search around in google everything in every keyword combination i could do but seems no one has example about this.
I tried using #jwt.revoked_token_loader to handle the RevokedTokenError but it seems it doesn't work as I applied it like this
#jwt.revoked_token_loader
def revoked_token_response(revoked_token):
jwtkn = revoked_token['jti']
return jsonsify({
'msg': 'token {} already been revoked!'.format(jwtkn)
)}, 401
actually, i don't know exactly how does the example on the link to handle expired tokens had parameter of 'expired_token', is that self-declaration like what I did above on the 'revoked_token'?? as far as I know, 'jti' is like a default value in the flask-jwt-extended package as I see error whenever I don't use this (in my db, it is different but there is no problem at all.
I tried following this tutorial and it works out fine on my side (as well his original code source) but I see that this one doesn't have a catch exception also on Revoke Tokens https://codeburst.io/jwt-authorization-in-flask-c63c1acf4eeb
I use postman and if based on the tutorial link, here's how i get this
i do login
i use the access token generated to access protected routes ('/secrets')
i do logout
i use again the access token generated to access protected routes
after the last one, i get this error on my server side (ide):
....flask_jwt_extended\utils.py", line 216, in verify_token_not_blacklisted
raise RevokedTokenError('Token has been revoked')
flask_jwt_extended.exceptions.RevokedTokenError: Token has been revoked
127.0.0.1 -- [02/Jul/2019 22:25:26] "GET /secrets HTTP/1.1" 500 -
in postman, this is what I get:
{
'message': 'Internal Server Error'
}
my target is to send out a custom json response instead of 'Internal Server Error'
edit:
I am no wiz on programming or such, a beginner that wanted to practice out python about secured web development. I don't yet quite understand still how decorator works out in terms of application, etc. so i don't know if others tweaks out the flask-jwt-extended package to work such things out.
Getting back a 500 error normally occurs because of a bug in other flask extensions and how that interact with native flask errorhandlers. You can find a bunch of discussions about it here (https://github.com/vimalloc/flask-jwt-extended/issues/86), but the tl;dr version is you might need to set app.config['PROPAGATE_EXCEPTIONS'] = True if using something like Flask-Restul, or use a hack like this if using flask-restplus:
jwt = JWTManager(app)
api = Api()
jwt._set_error_handler_callbacks(api)
If those don't help you, please take a look through that linked github issue, and if nothing in there helps make a reply in that issue detailing your setup.
Cheers.

Live SDK - server_internal_error - message - An error occurred while retrieving the resource. Try again later

Currently it looks like the lice SDK returns error 500 for all request. Also the interactive SDK Microsoft provides here returns the same error:
http://isdk.dev.live.com/dev/isdk/ISDK.aspx?category=scenarioGroup_core_concepts&index=1
My application work without any changes for over 24 months. Has someone any more details or a workaround?
Update: I tried the following API calls both with the same result:
https://apis.live.net/v5.0/me?access_token=#Token#
https://apis.live.net/v5.0/me/picture?access_token=#Token#
Finally, and after a very long downtime (more than 20 hours) the Live API is up & running again.
Unfortunately, there is not even an official announcement from Microsoft.
Up & Running
Have the same problem and all of my apps worked before for very long time.
I'm using LiveSDK 5.6 and getting successful response for LiveAuthClient.LoginAsync with the following scopes: "wl.signin", "wl.basic", "wl.contacts_photos", "wl.contacts_skydrive",
"wl.skydrive_update"
LoginAsync returns LiveLoginResult object where:
Status = Connected
Session = {Microsoft.Live.LiveConnectSession} with AccessToken
but when app trying to call
Session (LiveConnectClient) object with GetAsync ("/me")
I'm getting the following exception
[Microsoft.Live.LiveConnectException] = {"An error occurred while retrieving the resource. Try again later."}
ErrorCode = "server_internal_error"
The OneDrive service experienced a service outage on the 9th, you can see from this 3rd party site for an idea of the timeline. We did not communicate this issue well to you and other developers that have come to expect excellence from OneDrive.
It is the start of a long weekend and I do not have more answers for you at this time, I'll circle back next week with better details on what to do in the future.
The Live Connect API that the LiveSDK works in conjunction with has been replaced by the OneDrive API, which also has SDKs for most major platforms. You will see major performance improvements and a larger feature set such as a modern sync API available for you with this new API if you transition to it.

get customfield value for jira issue using JIRA SOAP API

I want to get the values of all custom fields for a particular JIRA issue using SOAP API. I have a custom field named 'Phase' having value Decision Pending for a JIRA issue JIRA-123.
I am using JIRA 5.1.3.
I am able to get all the properties of JIRA issue using SOAP API except the value of the custom field for above issue.
I tried following code, but I am not able to use ComponentManager in my code
IssueManager issueManager = ComponentManager.getInstance().getIssueManager();
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
Issue issue = issueManager.getIssueObject("JIRA-123");
CustomField customField = customFieldManager.getCustomFieldObjectByName("Phase");
Object customFieldValue = issue.getCustomFieldValue(customField);
I would highly appreciate if anyone can provide correct approach.
The SOAP API is deprecated by 5.1.3. I suggest you use the REST API - it is both more easy to use and implement.
What is REST?: read here. The basic idea is to bind HTTP request types to actions, it's quite obvious - check this table for a quick run-in.
Jira has a powerful REST API that you can use. This is the main documentation of the current release.
What do you need to do in some high-level steps?:
Set-Up some type of authentication with your JIRA instance. Be it:
Baisc - example
OAuth - example
Get a list of all fields via the API:
The /rest/api/2/field' [method returns a list of all fields][6] - both System and Custom.
Then when you identify the exact field use/rest/api/2/customFieldOption/{id}` to get the full
representation of the Custom Field Option.
I recommend you use a tools like Chrome REST Console ,or anything similar that you can easily make requests with, to get to know the API. The bonus is that you don't need to setUp authentication if you're logged in through the same browser. Your user will require full admin access though.
This is the root of all JIRA REST API docs. Check it out.
If you're doing this in PHP I would personally recommend using some kind of library. I've used
Guzzle (in a CakePHP environment) for this exact task and it turned out very well.
I'm not sure of how do you use the soap API, here is example of using it via the PHP-SOAP:
#!/usr/bin/php -q
<?php
$soapClient = new SoapClient("https://jira.com/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$myIssue = $soapClient->getIssue($token,"TES-13");
print_r($myIssue); // all of the issue details
print_r($myIssue->customFieldValues); // get all custom fields
foreach ($myIssue->customFieldValues as $customFieldValue) {
// search for the right custom field
if ($customFieldValue->customfieldId == 'customfield_10402') {
echo $customFieldValue->values[0];
die();
}
}
?>
In case you want to use any other API, have a look at the JIRA Remote API Reference.
A remark regarding the REST and SOAP APIs -To quote from Jira's site the SOAP API "Supported but no future development". The Rest API is still a bit new and there are things you can't yet do with the REST API (example), and can be done easily using the SOAP API.

Facebook API - Feed.registerTemplateBundle issues

I'm trying to build a feature into my framework wrapper that automates registering template bundles. I've gotten to the point where it seems like I can do so successfully using the Feed.registerTemplateBundle API method - I don't get an error, and I do get a template id back. However, the template doesn't show up in the "Registered Templates Console", and if I try to publish a story using the id, it gives me an "invalid template bundle id" error.
Any suggestions?
I had this problem in Facebook's official example application (TheRunAround)
it was registering template but when it tried to get an id it was
using sprintf (like: sprintf('%d', ))
current template ID's are out of the 32bit range so it was returning wrong id.
May it be the cause?
Turns out there were two problems:
I was erroneously double-json-encoding the short story template
Facebook was accepting the erroneously-formatting calls and returning an id, thus resulting in the creation of "phantom" template bundles that weren't showing up in their console.
I've fixed my code, and the bug has been reported (and I believe since fixed).