Ink Filepicker convert - The FPFile could not be converted with the requested parameters - filepicker.io

I have an application setup in Filepicker. This application uploads directly to my S3 bucket. The initial pickAndStore() function works well. The follow up convert function always fails with the 403 error "The FPFile could not be converted with the requested parameters". I have the following code:
try {
filepicker.setKey(apiKey);
filepicker.pickAndStore(
{
extensions : [ '.jpg','.jpeg','.gif','.png' ],
container : 'modal',
services : [ 'COMPUTER', 'WEBCAM', 'PICASA', 'INSTAGRAM', 'FACEBOOK', 'DROPBOX' ],
policy : policy,
signature : signature,
},
{
location : 'S3',
multiple : false,
path : path,
},
function(InkBlobs){
filepicker.convert(
InkBlobs[0],
{
width : 150,
height : 150,
fit : 'max',
align : 'faces',
format : 'png',
policy : policy,
signature : signature,
},
{
location : 'S3',
path : response.path + fileName + '.png',
},
function(InkBlob) {
console.log(InkBlob);
},
function(FPError) {
console.log(FPError);
}
);
},
function(InkBlobs){
console.log(JSON.stringify(InkBlobs));
}
);
} catch (e) {
console.log(e.toString());
}
The error handler function is always called. The raw POST response is...
"Invalid response when trying to read from
http://res.cloudinary.com/filepicker-io/image/fetch/a_exif,c_limit,f_png,g_face,h_150,w_150/https://www.filepicker.io/api/file/"
...with the rest of my credentials appended. The debug handler returns the previously mentioned message with the moreInfo parameter pointing to a URL "https://developers.filepicker.io/answers/jsErrors/142" which has no content on it about the error.
I thought the problem might be that using S3 directly means the file is not present on the Filepicker system to convert. I tried using the standard pick() function without any S3 uploading and then converting the resulting InkBlob. That produced exactly the same error message.
Any help would be appreciated.

In this instance, the error is in the use of faces and fit max. When using faces, you can only set fit to crop.
The interpretation in the command above is to find the faces, but set the image to fit the max allowed size.

Try removing the "path" option in the policy.
Specifying the path in the policy works well for pickAndStore(), though if you specify a path in your policy for convert, filepicker will give you a 403 error adressing the conversion parameters. Seems like the API won't know if it's the source or destination path.

Related

Can not send POST request in Postman

My POST request body (raw form) in Postman looks like -
{
"issueDescription" : "New issue reported",
"type" : "Managed services",
"priority" : "LOW",
"description" : "This is a TEST, please ignore",
"contactEmail" : "some.one#somewhere.com",
"contactName" : "abc",
"partnerTicketID" : "IN00012345"
}
I have Header specified as 'Content-Type = 'application/json'
The URL/endpoint is correctly specified - 'https://somecompany.com/rest/incident/
When clicked 'SEND', it gives following error (response) -
//
<rsp code="error">
<msg>The Object passed in should not be null.</msg>
</rsp>
//
What am I doing wrong?
Would you be able to provide more information about the endpoint you're sending the request to? What kind of object is it expecting? Is it expecting a json string?
The rest/incident/API method returned an error message specifying that The Object passed in should not be null.
But that error message is very vague and you haven't included the API method code, so we can't tell you which property should be specified.
I recommend that you either read the API code or talk to the developer responsible for that code to understand which property you should specify.

Creating Job from REST API returns a request property name error

I have my Asset and MediaProcessor ready. Now I am trying to encode my asset. When I send the request specified in the tutorial (http://msdn.microsoft.com/en-us/library/jj129574.aspx):
{
"Name":"CurlTestJob",
"InputMediaAssets":[
{
"__metadata":{
"uri":"https://wamsbluclus001rest-hs.cloudapp.net/api/Assets('nb%3Acid%3AUUID%3A429967f5-4709-4377-bab2-4680ae2a0dd87')"
}
}
],
"Tasks":[
{
"Configuration":"H.264 HD 720p VBR",
"MediaProcessorId":"nb%3Ampid%3AUUID%3A2e7aa8f3-4961-4e0c-b4db-0e0439e524f5",
"TaskBody":"<?xml version=\"1.0\" encoding=\"utf-8\"?><taskBody><inputAsset>JobInputAsset(0)</inputAsset><outputAsset>JobOutputAsset(0)</outputAsset></taskBody>"
}
]
}
I get the following response
{
"odata.error":
{
code: "";
message:
{
lang: "en-US";
value: "Parsing request content failed due to: Make sure to only use property names that are defined by the type";
};
};
}
I am using api-version 2.2
Can someone explain to me where am I wrong?
Try setting the Header "DataServiceVersion: 2.0"
I ran into the same issue when using "DataServiceVersion: 3.0"
The error says that properties in json file does not match the properties in the deserialized type.
http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.mediaservices.client.iasset.aspx shows that IAsset has property Uri, but say nothing about __metadata. You could try to change your json to
"InputMediaAssets":[{
"Uri":"https://wamsbluclus001rest-hs.cloudapp.net/api/Assets('nb%3Acid%3AUUID%3A429967f5-4709-4377-bab2-4680ae2a0dd87')"
}],

How to update a document using a rest service (extension library) in XPages

i am trying to update a specific document by using rest service control.
I have set up the control (documentJsonService, pathInfo, form name etc)
I know that i have to perform a post (patch) request to the url of the service followed by /unid/ (same way as i ve done to read the document using the same rest).
I have an input field and a button. I want to enter a value to the field, press the button and update a field in the document with the value. How can i do this request?
This is the js function i used in worklight to update a document in Domino:
function updateDoc(docId,newValue) {
var identity = Base64.encode("myDominoUsername:myDominoPassword");
path = "/Databases/Temp/dominoApp.nsf/BestRestTest.xsp/updateService/unid/"+docId;
var input = {
method : 'post',
returnedContentType : 'json',
headers:{
Authorization: "Basic "+"b4lzdD234GG3M6SdW1XI=" //base64 encoding of your //credentials, see above. The function Base64.encode can be found by googling about it in //js. So you replace this string with identity variable.
"X-HTTP-Method-Override":"PATCH",
"Content-Type":"application/json"
},
body: {
contentType: 'application/json; charset=utf-8',
content: JSON.stringify({"theField":newValue})
},
path : path
};
return WL.Server.invokeHttp(input);
}
Now on the Domino side i have added an extension library REST control (alternatively you can do it with Domino Data Service). The properties i ve added are:
pathInfo: whatever you want
service: documentJsonService
computeWithForm:true
defaultItems:true
formName:myformName
This is just client side javascript, so you can do it in a similar way from an XPage.

XMLHttpRequest cannot load *...* Origin : * is not allowed by Access-Control-Allow-Origin

I am trying to use extjs store to talk to a Jersey rest Java application (running at tomcat) that returns a Json.
And I am trying to use Json to print to a grid component.
This is my store code.
Ext.define('WSC.store.Users', {
extend: 'Ext.data.Store',
fields: ['period','tot_units', 'tot_selling_price'],
model: 'WSC.model.User',
proxy: {
type: 'rest',
url : 'http://localhost:8080/mondrianCube/services/query/querygoeshere/json',
reader: {
type: 'json',
root: 'table'
}
},
autoLoad: true
});
The store was not able to read the json obtained. Most of the recommendations were to add response headers(Access-Control-Allow-Origin) to the webapp(running at tomcat).
So I added the response headers like below.
#Path("/query/{qryParam}/json")
#GET
#Produces(MediaType.APPLICATION_JSON)
public static Response jsonResult(#PathParam("qryParam") String qryParam) throws JSONException
{
executeQuery("select {[Measures].members} on columns, {Time.[2010], Time.[2010]} on rows from sales" );
String json = (new JSONObject(((new ResultSetConvert(result)).toJson()))).toString();
return Response.ok(json).header("Access-Control-Allow-Origin","*").build();
}
Even then I get the same error as below
What am I missing here?
P.S If the url points to a file in the same domain, the store is able to read the json in the file.
I believe you'll want to use JSONP for this, for example,
Ext.get('search-form').on('submit', function(ev) {
ev.preventDefault();
Ext.ux.JSONP.request('http://api.flickr.com/services/feeds/photos_public.gne', {
callbackKey: 'jsoncallback',
params: {
format: 'json',
tags: Ext.fly('search-value').dom.value,
tagmode: 'all',
lang: 'en-us'
},
callback: updateResults
});
return false;
});
jsonp by wikipedia definition
JSONP or "JSON with padding" is a complement to the base JSON data format. It provides a method to request data from a server in a different domain, something prohibited by typical web browsers because of the same origin policy.
Same origin policy by definition
In computing, the same origin policy is an important security concept for a number of browser-side programming languages, such as JavaScript. The policy permits scripts running on pages originating from the same site to access each other's methods and properties with no specific restrictions, but prevents access to most methods and properties across pages on different sites.[

Chrome Extension : content script on facebook

I am creating a chrome extension for facebook.
I need to execute the same content script on every page. It works well during the first load but it doesn't work when I go to a facebook page thanks to a link (as the profile name).
I read this was because not the entire page was loaded except the first time. So the script is not executed again.
However I have no idea how to solve this problem.
Here is my manifest.json :
{
"name" : "name",
"version" : "1.0",
"manifest_version":1,
"description" : " description ",
"content_scripts" : [
{
"matches" : ["http://www.facebook.com/*"],
"js" : ["test.js"]
}
] ,
"all_frames":"true"
}
I hope someone will have the answer because I really need the script (test.js, which doesn't change the html or the css) to be executed on every page every time!
Thanks for your future answers.
I personally solved this by using Chrome's webRequest API. You'll want to add a listener that tracks AJAX-generated HTTP calls. Here's essentially the code I used:
chrome.webRequest.onCompleted.addListener(function(details) {
var url = document.createElement('a');
url.href = details.url;
if (url.search && url.search.indexOf('ajaxpipe=1') !== -1) {
console.log('New page via AJAX.');
chrome.tabs.executeScript({'file' : 'test.js'});
}
}, {urls : ["*://*.facebook.com/*"]});