getFullUrl for a picture in apstrata without downloading it
  • Hi karim,

    I used to work with ApstrataClientAndroid but it is deprecated now as u previously mentioned, and at that time I used to add the below to get the full url of an image  without downloading it:

    picParams.add(new BasicNameValuePair("apsdb.fileName", "orange.jpg"));
    picParams.add(new BasicNameValuePair("apsdb.fieldName", "file"));
    picParams.add(new BasicNameValuePair("apsdb.documentKey", ad_doc.getString("key")));

    String pictureURL = client1.getFullUrl("GetFile", picParams, AuthMode.COMPLEX);

    My question in Client class what function could I use so that I can get the url of an image given its name 

    I tried using 

    Map<String, List<File>> files = null;
    String pictureURL = client1.getSignedRequestUrl("GetFile", picParams, files, AuthMode.SIMPLE);

    but it not working.

    Thank you.

  • Hello Nour,

    You actually used the correct method but its documentation is not very explicit about what you should do.
    Indeed, what the method does is to generate the first part of the URL with the signature (obtained from your credentials and the parameters you sent) but without adding the parameter names and values to it! 

    As a consequence, you still have to add these yourself to the resulting URL, as in the below example:

    UserConnection connection = null;
    try {
    connection = new UserConnection(BASE_URL, ACCOUNT_KEY, USER_NAME, PASSWORD);
    Client client = new Client(BASE_URL, ACCOUNT_KEY, connection);
    List<NameValuePair> parameters = new ArrayList<NameValuePair>();
    BasicNameValuePair docKey = new BasicNameValuePair("apsdb.documentKey", "filedoc");
    BasicNameValuePair store = new BasicNameValuePair("", "myStoreName");
    BasicNameValuePair fileField = new BasicNameValuePair("apsdb.fieldName", "myFileFieldName"); //e.g. "apsdb_attachments"
    BasicNameValuePair fileName = new BasicNameValuePair("apsdb.fileName", "myFileName"); parameters.add(docKey);
    String response = client.getSignedRequestUrl("GetFile", parameters, null , AuthMode.SIMPLE);
    response += "";
    } catch (Exception e) {
    // exception handling code
    } finally {
    // clean-up

  • Hi Karim,

    I implemented the above:
    response += "&";

    and it is working now

    Thank you.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!