Open selimnairb opened 10 years ago
These are the end point URLs we are using at BYU:
base_url points to the Export.php script that packages data files for download. base_url="http://dev.hydroshare.org/export.php?file=http://dev.hydroshare.org/sites/default/files/{0}.zip"
The url from which a list of available resources can be found list_url="http://dev.hydroshare.org/?q=my_services/node.json"
Thanks Cuyler.
Does anyone know the URL for creating resources?
Here are a few helpful tutorials/blog posts on this topic:
https://drupal.org/node/1447020
file creation example:
http://tylerfrankenstein.com/code/drupal-services-file-create-example-json-and-jquery
I now think I understand the basic mechanics/REST calls needed to create a resource in Hydroshare (i.e. a node in Drupal). One major area I am still unclear on is how to authenticate as a regular user before creating a resource. Interactions like this: connect, login, do things, logout; don't work for me. I'm not reliably able to login. For example:
POST: http://dev.hydroshare.org/?q=my_services/user/login.json&api-key=581d46dd
Content-type: application/json
Data: username=admin&password=
Results in my being prompted for username and password via BASIC authentication. If I don't supply it, I get: 401 Unauthorized: Missing required argument username
That's because that's not a BASIC authentication. That must be done in the headers, not as username= and password= params in the HTTP request. http://en.wikipedia.org/wiki/Basic_access_authentication has a list of what you have to do. Setting headers is not hard, but it's client specific.
On Tue, Nov 26, 2013 at 2:21 PM, Brian Miles notifications@github.comwrote:
I now think I understand the basic mechanics/REST calls needed to create a resource in Hydroshare (i.e. a node in Drupal). One major area I am still unclear on is how to authenticate as a regular user before creating a resource. Interactions like this: connect, login, do things, logout; don't work for me. I'm not reliably able to login. For example:
POST: http://dev.hydroshare.org/?q=my_services/user/login.json&api-key=581d46dd Content-type: application/json Data: username=admin&password=
Results in my being prompted for username and password via BASIC authentication. If I don't supply it, I get: 401 Unauthorized: Missing required argument username
— Reply to this email directly or view it on GitHubhttps://github.com/hydroshare/hydroshare/issues/33#issuecomment-29323108 .
Basic authentication seems not to be working. I can only access REST services on dev.hydroshare.org by supplying the API key. See the attached screenshots. I may be doing something wrong. However it may be that the test username and password changed.
Thanks.
Brian
I don't know what the API Key is and therefore can't access the web services. Could someone explain to me how the authentication works?
The test api-key is: 581d46dd
This from the API Key authentication docs:
3) Making a request to the endpoint with a Key The module will look for a POST or GET element called 'api-key' and look to compare this value against the API Key defined for the endpoint. Any requests without this value or with an invalid value will be blocked.
On Mon, Dec 2, 2013 at 3:30 PM, cuylerfrisby notifications@github.comwrote:
I don't know what the API Key is and therefore can't access the web services. Could someone explain to me how the authentication works?
— Reply to this email directly or view it on GitHubhttps://github.com/hydroshare/hydroshare/issues/33#issuecomment-29654463 .
Enable Drupal services REST API/determine end point URL; /services/rest/... (which I learned from https://drupal.org/node/783254), does not seem to work.