MaidSafe Dev Update :safe: 15th March 2016

Yep, did that. Quite strange.

1 Like

It took me a while to get everything compiled and running, but made progress.

I managed to successfully POST and GET and file (which didnā€™t work before), but PUT failed with ā€˜Method PUT is not allowed by Access-Control-Allow-Methods in preflight response.ā€™

On a related note, whenever I try to change isPathShared to true, I get 400 errors (when it previously worked as false). Is a specific path/parameter required?

1 Like

The path parameter is optional. By default it will treat it as falseā€¦ If isPathShared parameter is set to true, the launcher will consider that the dirPath/filePath is present in the SAFEDrive of the user, else it will consider that the dirPath/filePath is present in the Applicationā€™s root directory itself. If the app wants to access the SAFEDrive then the application must request for approval from user by specifying the same in the permissions list at the initial authorisation request.
Instead of empty permission list, the permission list should be [ā€˜SAFE_DRIVE_ACCESSā€™]. If the app tries to access the SAFEDrive without the permission, this will cause a 400 (Bad Request).

3 Likes

For some reason I canā€™t register a DNS service for an already existing DNS, the http://api.safenet/dns call fails with this error:

registerService Error: {"errorCode":-1001,"description":"DnsError::DnsNameAlreadyRegistered"}

The only way I can get that API call to work is if I choose a DNS name that doesnā€™t exist yet. So even if no service has been registered, just the DNS name through http://api.safenet/dns/:longName, I get the same error when registering the first service for it.

Thanks for all your feedback @Krishna_Kumar!

1 Like

@Seneca - The DNS is a bit finicky. There is a difference between the (documented) DNS registration /dns which creates a DNS name and DNS service at the same time when called and (undocumented) DNS add service (same path/body but a PUT instead of a POST) which uses an existing DNS name that might have been created with /dns/:longName and just creates a new service. Log in with Atlassian account has been opened to address this (and other) documentation issues.

3 Likes

Thanks, that helped!

Edit: Below is solved

I now have trouble with the /dns/:serviceName/:longName/:filePath GET. It seems like I canā€™t get the URL right (error 500).

One thing Iā€™m unsure about is :filePath, because it says:

The full path of the file from the root of the service home directory. The path must be url encoded.

With an example value of:

var filePath = '/photos/sample.txt'

So, is in this context /photos the root of the service home directory, i.e. the serviceHomeDirPath in the /dns POST? Or is /photos a newly created directory inside the serviceHomeDirPath, so the actual path in the NFS is something like /www/photos?

Also, does isPathShared tie into this somehow?

1 Like

Turning the Authorization header off seems to resolve the error 500. We arenā€™t allowed to make an Authorized request for public data it seems?

P.S. it seems in the example /photos was not the root directory.

2 Likes

@Seneca - That is correct. I specifically mentioned this at

but it was not addressed. For now you are not allowed to use authentication where it is not needed. (I also mentioned they should stop using 500 for something that is the clientā€™s fault, but many 500ā€™s are still returned).

5 Likes

I am currently working on an AngularJS module which will wrap the Safe API. I have a few days off work over the next couple of weeks, so it seemed like a good idea to experiment with the API and brush up on some modern JavaScript approaches.

I am not sure if anyone else is working on this, but it may be useful to others if not. I have a couple of other ideas relating to web installers too which will require the foundations.

I will stick an announcement thread up once there is something worth announcing!

9 Likes

@Krishna_Kumar will the next launcher binary address this and the other CORS related issues? It would be great to have this resolved and have safenet sites starting to showing off their dynamic potential.

5 Likes

@Shankar has fixed the issue with his PR.

Please note, for the PUT and POST requests the Content-Type header should be set as text/plain.

6 Likes

Good to hear! I also hit a similar problem with not being able to remove authentication (DELETE) due to CORS. I am working through all the API calls/combinations, so just spotting them when I hit them. There may be a few others lurking.

1 Like

DELETE also should be working fine with the latest master. All the methods used from the REST Api has been added to the Allowed list.

2 Likes

Are any strides being made into Hard Wallet compatibility with regards to exporting Maids to Omni or something of the like? =O

1 Like