Adobe Sign API Create Web Form issue : use exist template - ajax

How to use the template in Adobe sign API POST /widgets API.
I can't get transientDocumentId of Template.
Please help me with this.

I have found the solution.
$.ajax({
...
data: JSON.stringify({
fileInfos: {
libraryDocumentId: "{libraryDocumentId}" // instead transientDocumentId
},
...
})
})

Related

How can I get the user first name from facebook in cloud code?

How can I get the user first name from facebook in cloud code?
I can do it using objC and in the app, but I want from the server, cloud code.
How can I send a facebook request from cloud code? do I have to use the access token saved in authData in any way? Thanks
It seems that you can use a graph search
FB.api('/me', function(response) {
alert('Your name is ' + response.name);
});
But they donĀ“t recommend you to get Facebook data of a user using the Parse Cloud
Check it out
https://www.parse.com/questions/get-user-info-from-facebook-javascript-sdk-after-login
For those browsing this now that docs are getting out of synch after FB drop this was not officially supported as per https://groups.google.com/forum/#!topic/parse-developers/mw7qhHGIsOc
IMHO best bet ATM is to use the graph API directly. Within a Parse.Cloud function:
let access_token = request.user.get('authData').facebook.access_token
Parse.Cloud.httpRequest({
url: 'https://graph.facebook.com/v2.8/' + path + '&access_token=' + access_token
})
.then(function(result) {
console.log(result)
}, function(error) {
console.log(error)
})
for the original question let path='me?fields=first_name' or FB_ID if not me

Post data to RESTful Invalid HTTP status code 405

I create a method to post json data to web service :
function WishList() { }
WishList.prototype.addToWishList = function(redirectURL, postURL, userObj) {
$.ajax({
type: "POST",
url: postURL,
data: JSON.stringify(userObj),
dataType: 'json',
contentType: "application/json",
success: function(data){alert(data);},
failure: function(errMsg) {
alert(errMsg);
}
}
This is my object:
var user1 = {
ID:1,
Sex:1,
Name:"titi",
Company:"ABC",
Address:"Phnom Penh",
Email:"test.abc#gmail.com",
Phone:"011123456",
WebAccount:"test.abc#gmail.com",
Password:"123456",
GroupCustomerID:125,
Stars:1,
IsVIP:0,
PriceLevel:1,
LastDateSale:"\/Date(-62135596800000)\/",
TotalCredit:150.12,
AgingData:null,
TotalRedeemPoint:1000.00,
RedeemData:null,
ExchangeRate:155.00,
HistoryData:null
};
Calling function :
$(document).ready(function () {
var myWishList = new WishList();
$('#addToWishList').click(function(){
myWishList.addToWishList('http://www.blahblahblah.com' , 'http://blahblah/Website/Products/Product.svc/Wishlist/' , user1);
});
});
Then I got errors in my console :
"NetworkError: 405 Method Not Allowed in firefox and Invalid HTTP status code 405 , XMLHttpRequest cannot load url in chrome.
Note: When I use Rest Client of Chrome to POST to web service, it worked.
Any help would be much appreciated, thank you.
Not sure what you are using as the service on the other end but this may be due to cross domain posting. I hate to post a link and run but this may be of some use to you.
http://praneeth4victory.wordpress.com/2011/09/29/405-method-not-allowed/
Looks like they could get it working in IE but had some issues as you with the other browsers. Perhaps these couple changes will help access the service better.
This post was good at explaining the error and parts to it as well so if the above link is not helpful this one may help you diagnose the issue further.
http://www.checkupdown.com/status/E405.html
ok ok last edit, just wanted to make sure you have enough info to hopefully resolve your issue, here is a good article on the underlying problem I believe you are having..
http://www.d-mueller.de/blog/cross-domain-ajax-guide/

JSONP pass api key

I've got an arduino uploading sensor data to cosm.com. I made a simple webpage on my local web server to query the cosm.com API and print out the values.
The problem is that if I am not logged into cosm.com in another tab, I get this popup.
The solution is to pass my public key to cosm.com, but I am in way over my head here.
The documentation gives an example of how to do it in curl, but not javascript
curl --request GET --header "X-ApiKey: -Ux_JTwgP-8pje981acMa5811-mSAKxpR3VRUHRFQ3RBUT0g" https://api.cosm.com/v2/feeds/120687/datastreams/sensor_reading
How do I pass my key into the url?:
function getJson() {
$.ajax({
type:'GET',
url:"https://api.cosm.com/v2/feeds/120687/datastreams/sensor_reading",
//This line isn't working
data:"X-ApiKey: -Ux_JTwgP-8pje981acMa5811-mSAKxpR3VRUHRFQ3RBUT0g",
success:function(feed) {
var currentSensorValue = feed.current_value;
$('#rawData').html( currentSensorValue );
},
dataType:'jsonp'
});
}
UPDATE:
It must be possible because hurl.it is able to query the api
http://www.hurl.it/hurls/75502ac851ebc7e195aa26c62718f58fecc4a341/47ad3b36639001c3a663e716ccdf3840352645f1
UPDATE 2:
While I never did get this working, I did find a work around. Cosm has their own javascript library that does what I am looking for.
http://cosm.github.com/cosm-js/
http://jsfiddle.net/spuder/nvxQ2/5/
You need to send it as a header, not as a query string, so try this:
function getJson() {
$.ajax({
type:'GET',
url:"https://api.cosm.com/v2/feeds/120687/datastreams/sensor_reading",
headers:{"X-ApiKey": "-Ux_JTwgP-8pje981acMa5811-mSAKxpR3VRUHRFQ3RBUT0g"},
success:function(feed) {
var currentSensorValue = feed.current_value;
$('#rawData').html( currentSensorValue );
},
dataType:'jsonp'
});
}
It should be much easier to get it to work using CosmJS. It is an officially supported library and provides full coverage of Cosm API.

Google Plus connect API using jQuery/Ajax

I am trying to trigger the Google plus connect API within a jquery/ajax function.
The response I get is undefined. Firebug shows an empty response.
This is the code I am using:
function gPlusConnect ()
{
console.debug('line 401 ajax gestartet');
result=$.ajax({
type: 'POST',
async: false, // false
url: 'https://accounts.google.com/o/oauth2/auth',
data: ({
scope:'https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile',
state:'/profile',
redirect_uri:'https://ssl.webpack.de/learnface.de/donation/launchpages',
response_type:'code',
client_id:'.........82.apps.googleusercontent.com',
})
}).responseText;
console.debug('index.php 415 ajax ends with '+result+' from g+');
}
The result in firebug is:
Header Post Antwort HTML
index.php 415 ajax ends undefined from g+
Has anyone done this successfully? Do you recommend a better alernative?
It's a lot easier to use OAuth 2.0 on Google with the official client libraries. Authorizing users this way with the JavaScript client library is really easy:
<script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
<script>
function handleClientLoad() {
gapi.client.setApiKey(apiKey);
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);
}
function handleAuthResult(authResult) {
console.log(authResult);
}
</script>
You can find a more detailed sample in the source code tree for the client library, and learn more about the library on its code hosting project.

sencha touch - ajax call to server (url , extra parameter formation)

I am using this to get the result from server
controller.allVisitStore = new Ext.data.Store({
model: 'allVisit',
autoLoad : true,
proxy: {
type: 'ajax',
id: 'allvisit_app_localstore',
url: '/RadMobApp/api',
extraParams:{
action:'query',
queryName:'GET_ALL_VISIT',
authToken: localStorage.getItem("auth_token"),
patTicketId: localStorage.getItem("patientId"),
retFormat:'XML',
keyValuePair:'yes'
},
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "T4" tag
record: 'data'
})
}
});
but i am not getting any thing.But i formed this url in browser and checked this i got the correct result. now here i want to check is there any problem in the url formation.How to check the url formation with extra parameter which is pass through ajax. I have checked in Inspect element-> network -> api there is no any api request found there.Is anything wrong in my code. Thanks in advance...
Use Firebug for Firefox or Chrome's developer tools to see what's going on when that store attempts to load itself. My hunch is that your url is incorrect and should be url: '/api' because RadMobApp is probably your app root.

Resources