Repository: AlexsLemonade/refinebio

Issue:
Remove 'Basic Authentication' from API docs
### Context

We don't actually use HTTP's Basic Authentication, but the API docs say we do.

### Problem or idea

This confused the first external user of our API: @awm33

### Solution or next step

We should not say we use Basic Authentication on our API docs.



Discussion:
Instead of making a second ticket, I'm just going to add here that we should also do a better job of specifying how to use our API tokens on each request that requires them. Currently we mention it on the token endpoint and here: https://api.refine.bio/v1/#tag/computational_results

However the dataset endpoint does not mention it.

Also in one place we say to pass it in as the `HTTP_API_KEY` header and in the other we just say `API_KEY`. All places should say the correct header.
Also I think it is actually `API-KEY` instead of `API_KEY` or `HTTP_API_KEY`.

Resolving patch:
diff --git a/api/data_refinery_api/settings.py b/api/data_refinery_api/settings.py
--- a/api/data_refinery_api/settings.py
+++ b/api/data_refinery_api/settings.py
@@ -185,7 +185,12 @@
 REST_FRAMEWORK = {
     'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
     'PAGE_SIZE': 25,
-    'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.URLPathVersioning'
+    'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.URLPathVersioning',
+}
+
+SWAGGER_SETTINGS = {
+    'USE_SESSION_AUTH': False,
+    'SECURITY_DEFINITIONS': {},
 }
 
 # Setting the RAVEN_CONFIG when RAVEN_DSN isn't set will cause the
diff --git a/api/data_refinery_api/views.py b/api/data_refinery_api/views.py
--- a/api/data_refinery_api/views.py
+++ b/api/data_refinery_api/views.py
@@ -377,9 +377,26 @@ class CreateDatasetView(generics.CreateAPIView):
 @method_decorator(name='put', decorator=swagger_auto_schema(operation_description="""
 Modify an existing Dataset.
 
-Set `start` to `true` along with a valid activated API token (from `/token/`) to begin smashing and delivery.
+In order to begin smashing, an activated API key must be provided in the `API-KEY` header field of the request.
+To acquire and activate an API key see the documentation for the [/token](#tag/token)
+endpoint.
 
-You must also supply `email_address` with `start`, though this will never be serialized back to you.
+```py
+import requests
+import json
+
+params = json.dumps({
+    'data': data,
+    'aggregate_by': 'EXPERIMENT',
+    'start': True,
+    'email_address': 'refinebio@gmail.com'
+})
+headers = {
+    'Content-Type': 'application/json',
+    'API-KEY': token_id # requested from /token
+}
+requests.put(host + '/v1/dataset/38879729-93c8-436d-9293-b95d3f274741/', params, headers=headers)
+```
 """))
 class DatasetView(generics.RetrieveUpdateAPIView):
     """ View and modify a single Dataset. """
@@ -540,16 +557,20 @@ class CreateApiTokenView(generics.CreateAPIView):
     """
     token_create
 
-    There're several endpoints like [/dataset](#tag/dataset) and [/results](#tag/results) that return
-    S3 urls where users can download the files we produce, however in order to get those files people
-    need to accept our terms of use by creating a token and activating it.
-
-    ```
-    POST /token
-    PUT /token/{token-id} is_active=True
+    This endpoint can be used to create and activate tokens. These tokens can be used
+    in requests that provide urls to download computed files. They are a way to accept
+    our terms of service.
+
+    ```py
+    import requests
+    import json
+    ​
+    response = requests.post('https://api.refine.bio/v1/token/')
+    token_id = response.json()['id']
+    response = requests.put('https://api.refine.bio/v1/token/' + token_id + '/', json.dumps({'is_activated': True}), headers={'Content-Type': 'application/json'})
     ```
 
-    The token id needs to be sent on the `API_KEY` header on http requests.
+    The token id needs to be provided in the HTTP request in the API-KEY header.
 
     References
     - [https://github.com/AlexsLemonade/refinebio/issues/731]()


Test patch: