We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

Can not get access token


vcasse
01-17-2014, 02:55 PM
Hi Vasilis,

Quote Originally Posted by Vasilis
Hi Vincent,

Your default container has two folders: test1 and test2.
How can I get only these two?
curl -H "X-auth-token: token" "https://lb0.hubic.ovh.net/v1/AUTH_tenant/default?path="
test1
test2
In your second example, how can I get the following result:

Code:
image (192nd copy).jpeg
image (221st copy).jpeg
tata
with the delimiter: "test1/toto/" ?
You must iterate on result and delete "test1/toto" from each string.

By the way, when I posted my issue on 01-09-2014, 02:36 AM, why did not you reply with this example?
Hum .. because I didn't understand your need

Regards,
Vincent

Vasilis
01-17-2014, 02:45 PM
Hi Vincent,

Your default container has two folders: test1 and test2.
How can I get only these two?

In your second example, how can I get the following result:

Code:
image (192nd copy).jpeg
image (221st copy).jpeg
tata
with the delimiter: "test1/toto/" ?

By the way, when I posted my issue on 01-09-2014, 02:36 AM, why did not you reply with this example?

vcasse
01-17-2014, 01:47 PM
Hi Vasilis,

Yes it's possible to list only a folder.

Ie, in my account, I have :
curl -H "X-auth-token: token" "https://lb0.hubic.ovh.net/v1/AUTH_tenant/default"
test1
test1/hahaha
test1/hahaha/image (160th copy).jpeg
test1/hahaha/image (161st copy).jpeg
test1/hahaha/image (166th copy).jpeg
test1/hahaha/image (171st copy).jpeg
test1/image (132nd copy).jpeg
test1/image (152nd copy).jpeg
test1/image (154th copy).jpeg
test1/image (160th copy).jpeg
test1/image (161st copy).jpeg
test1/image (166th copy).jpeg
test1/toto
test1/toto/image (192nd copy).jpeg
test1/toto/image (221st copy).jpeg
test1/toto/tata
test1/toto/tata/image (166th copy).jpeg
test1/toto/tata/image (171st copy).jpeg
test1/toto/tata/image (188th copy).jpeg
test2
If i want content of test1/toto :
curl -H "X-auth-token: token" "https://lb0.hubic.ovh.net/v1/AUTH_tenant/default?path=test1/toto"
test1/toto/image (192nd copy).jpeg
test1/toto/image (221st copy).jpeg
test1/toto/tata
And if i want recursivly content since test1/toto :
curl -H "X-auth-token: token" "https://lb0.hubic.ovh.net/v1/AUTH_tenant/default?prefix=test1/toto"
test1/toto
test1/toto/image (192nd copy).jpeg
test1/toto/image (221st copy).jpeg
test1/toto/tata
test1/toto/tata/image (166th copy).jpeg
test1/toto/tata/image (171st copy).jpeg
test1/toto/tata/image (188th copy).jpeg
This example could help you ?

Regards,
Vincent

Vasilis
01-17-2014, 12:54 PM
Hi Vincent,

I do not want to abuse the forum, and since you do not have a topic for apps, I do not wish to create a new thread in this topic.

With regards to my issue, the API can not list the files/folders within a single folder. Instead, it lists all files / folders that are available in a given container.

vcasse
01-17-2014, 11:05 AM
Hey Vasilis,

Open a new topic if you want to be more visible and have some feedbacks
What is your issue ? Delimiter problem ? Could you send your request please ?

Regards,
Vincent

Vasilis
01-17-2014, 10:46 AM
Hello everybody,

I am pleased to inform you that my iOS application "Rainbow - Sync your data between cloud like services" is available for download.

This application allows one to transfer files / folders between cloud services.

The current version is 2.0, and as it is expected it supports the Hubic cloud service.

You may download it from the AppStore

If you would like to read some info and instructions about this application, please visit the site
Rainbow

The Mac version does not support the Hubic cloud service, due to the issue that I brought up in my previous post

Thank you

PS. If this is not the right topic to make this post, please relocate it to the right topic

Vasilis
01-10-2014, 11:18 AM
Hi Vincent,

Lets hope that they will reply soon

vcasse
01-10-2014, 09:18 AM
Hi Vasilis,

Send your request
Delimiter system is a basis of running of all hubic applications.

Regards,
Vincent

Vasilis
01-10-2014, 12:05 AM
Hi Vincent,

I do not know why, but the trick with the delimiter did not work. I am receiving all objects.

Anyhow, I managed to create a local structure of the files on the fly, and it does work.

Vasilis
01-09-2014, 12:16 PM
Quote Originally Posted by vcasse
Hi Vasilis,

Great When you will finish your application, you could post a topic in forum to promote them
I will definitely do that

I will try the trick with the delimiter

Thank you

vcasse
01-09-2014, 09:11 AM
Hi Vasilis,

Great When you will finish your application, you could post a topic in forum to promote them

In hubic, we "build" folders with creation of empty files (0 octets) with Content-Type : "application/directory", with name's string ended by a '/'
After, to show content of one folder, you could use delimiter=/ and path=Documents/.
Read this doc : http://docs.openstack.org/api/openst...rectories.html (and example 3.42)

Regards,
Vincent

Vasilis
01-09-2014, 12:36 AM
Hi Vincent,

I finally managed to access my files !!

Now, I noticed something really weird.
I upload a file (i.e., demo.jpg) to folder "Documents". On the webpage I do see that file in the "Documents" folder. But, on my application, the "Documents" is empty, and the file appears as "Documents/demo.jpg". What could cause this?

I follow the instructions on page http://docs.openstack.org/api/openst...g-objects.html to list files/folders
The container is the "default"

Thank you

vcasse
01-08-2014, 01:35 PM
Hi Vasilis,

There are many good documentations on swift running on the web. Some good links :
- http://swiftstack.com/openstack-swift/architecture/
- http://docs.openstack.org/api/openst...e/1.0/content/

In your example, X-Auth-Token: fc81aaa6-98a1-9ab0-94ba-aba9a89aa9ae is token, and https://storage.swiftdrive.com/v1/CF_xer7_343 is endpoint of your account. With theses informations, you could send request to openstack. And you could have theses informations from "/account/credentials" inside hubiC Api.

Regards,
Vincent

Vasilis
01-08-2014, 12:16 PM
One last thing.

In order to access the files I need to use the OpenStack API. If it is not much trouble, could you give me an example? Could you give the the API to get a list of files / folders in the root folder?

I found this (in the example section)
Code:
$ curl X GET -i \
    -H "X-Auth-Token: fc81aaa6-98a1-9ab0-94ba-aba9a89aa9ae" \
    https://storage.swiftdrive.com/v1/CF_xer7_343
What is the "CF_xer7_343" and how did I get it?

Vasilis
01-08-2014, 12:04 PM
Hi Vincent,

Thank you for clarifying this for me.

On the site, you have

Code:
code=1389182525XNaDC4PmhipsuDvK9iMcpNeyjgs17Sl94ZDpRvHhPeO8VzbJwuwRhF3AVtlTcMAL
&redirect_uri=https://api.hubic.com/sandbox/
&grant_type=authorization_code
The "&" is used in the URL, this is what confused me

vcasse
01-08-2014, 10:50 AM
Hey Vasilis,

To understand how work the api, you could read and try https://api.hubic.com/sandbox/
My tip of the day : use firebug in firefox or dev tool in chrome to undestand how request are built

For oauth/token request, parameters must be send in body and Authorization in a request header.
With curl, request could be
curl 'https://api.hubic.com/oauth/token/' -H 'Authorization: Basic ****' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'code=***&redirect_uri=https%253A%252F%252F***.com %252F&grant_type=authorization_code'
Regards,
Vincent

Vasilis
01-07-2014, 11:42 PM
In order to get the access token I need to make a POST request

Should the code, redirect_uri and grand_type be in the URL or in the body? I presume that the Authorization is put in the body.

If I put the code, redirect_uri, and grand_type in the URL I get an error message regarding missing arguments.
If I put them in the body I get a server error.

The content-type is set to application/x-www-form-urlencoded charset=utf-8 ( I tried it without the charset=utf-8)

Here is the URL

https://api.hubic.com/oauth/token/?c...orization_code

The redirect_uri is properly escaped

Thank you

Vasilis
01-07-2014, 11:14 PM
Hi Vincent,

I double checked my URL with yours, and it turns out that I had forgotten to add the ending "/" in the redirectURI.

Now, I am having some issues with the access token, as I am receiving the html code of a web site. But since everything is in French, I can not understand what the problem is. I hope I resolve it soon.

Thank you for your help!

Vasilis
01-07-2014, 01:01 PM
Hi Vincent,

Because I am not in front of my computer, I will send them later tonight.

vcasse
01-07-2014, 12:57 PM
Hi Vasilis,

Could you send me yours requests (as i have show in my example) by MP ? Request with and without "&&" please.

Regards,
Vincent

Vasilis
01-07-2014, 12:50 PM
Hi Vincent,

Initially I was getting an error similar to yours, but I found out that I had the "&&" string in my URL. Once I fixed that, my code is not receiving any response from the Hubic server. The redirectURI is the one that I gave when I created the app.

vcasse
01-07-2014, 11:56 AM
Hi Vasilis,

I have no problem with my recently created credentials :

curl "https://api.hubic.com/oauth/auth/?client_id=api_hubic_*****&redirect_uri=https%3A%2 F%2F****.com%2F&scope=usage.r,account.r,getAllLink s.r,credentials.r,activate.w,links.drw&response_ty pe=code&state=RandomString_3tOMOwlH8" -i
(You must replace ClientID and RedirectUri).

If you have an error, you could get inside your redirect_uri : here i use a bad clientId and I have a 302 redirection with error inside

curl "https://api.hubic.com/oauth/auth/?client_id=api_hubic_****&redirect_uri=https%3A%2F %2F****.com%2F&scope=usage.r,account.r,getAllLinks .r,credentials.r,activate.w,links.drw&response_typ e=code&state=RandomString_3tOMOwlH8" -i
HTTP/1.1 302 Found
[...]
Location: https://***.com/?error=unauthorized_...ription=please verify credentials&state=RandomString_3tOMOwlH8
Regards,
Vincent

Vasilis
01-07-2014, 11:25 AM
Hi vcasse,

What do you mean? Are you referring to the URL that I am using to authenticate the user? If yes, I am using the one that you have in your demo page. The only difference is the clientID, which is the one for my application.

vcasse
01-07-2014, 09:00 AM
Hey Vasilis,

Could you send our request to authenticate your user ?

Regards,
Vincent

Vasilis
01-07-2014, 12:42 AM
Hello everybody,

I am trying to develop an iOS app that connects to my Hubic account. Unfortunately I am stack at the authentication step. I believe that the URL is correct, but the server does not responds, and I get a timeout. On the other hand, the demo URL with the sandbox redirectURI works fine (even though it does need some time to respond).
What could be wrong?

Thank you