Skip to content

Commit

Permalink
Remove .dev substring from api.dev.microbiomedata.org URLs (#309)
Browse files Browse the repository at this point in the history
* Update auth.md docs

* Remove `.dev` substring from `api.dev.microbiomedata.org` URLs

---------

Co-authored-by: eecavanna <134325062+eecavanna@users.noreply.github.com>
  • Loading branch information
shreddd and eecavanna committed Sep 22, 2023
1 parent 2b50178 commit e53dc77
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 40 deletions.
8 changes: 4 additions & 4 deletions demo/metadata_discovery/indexing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@
"import requests\n",
"\n",
"docs = []\n",
"rv = requests.get(\"https://api.dev.microbiomedata.org/biosamples?page=1&per_page=200\")\n",
"rv = requests.get(\"https://api.microbiomedata.org/biosamples?page=1&per_page=200\")\n",
"docs.extend(rv.json()['results'])\n",
"rv = requests.get(\"https://api.dev.microbiomedata.org/biosamples?page=2&per_page=200\")\n",
"rv = requests.get(\"https://api.microbiomedata.org/biosamples?page=2&per_page=200\")\n",
"docs.extend(rv.json()['results'])\n",
"rv = requests.get(\"https://api.dev.microbiomedata.org/biosamples?page=3&per_page=200\")\n",
"rv = requests.get(\"https://api.microbiomedata.org/biosamples?page=3&per_page=200\")\n",
"docs.extend(rv.json()['results'])\n",
"rv = requests.get(\"https://api.dev.microbiomedata.org/biosamples?page=4&per_page=200\")\n",
"rv = requests.get(\"https://api.microbiomedata.org/biosamples?page=4&per_page=200\")\n",
"docs.extend(rv.json()['results'])\n",
"len(docs)"
]
Expand Down
4 changes: 2 additions & 2 deletions docs/howto-guides/author-changesheets.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ flowchart LR;
* If you are modifying/replacing the value of a key in a document which has a *list* structure, then specifying a single value in the *value* column of the changesheet will be interpreted as a single element list. If you wanted to replace it with a multi-element list, then you can specify the individual elements of that list value in a pipe (`|`) delimited fashion in the *value* column of the changesheet


3. The third step is to use the validation endpoint from the runtime API which you can find [here](https://api.dev.microbiomedata.org/docs#/metadata/validate_changesheet_metadata_changesheets_validate_post). Click on *Try it out*, and upload your TSV file. You should see a `200` successful response for proper validation.
3. The third step is to use the validation endpoint from the runtime API which you can find [here](https://api.microbiomedata.org/docs#/metadata/validate_changesheet_metadata_changesheets_validate_post). Click on *Try it out*, and upload your TSV file. You should see a `200` successful response for proper validation.

4. The fourth and final step in the protocol is to actually submit the changesheet using the submission endpoint from the nmdc-runtime API which you can find [here](https://api.dev.microbiomedata.org/docs#/metadata/submit_changesheet_metadata_changesheets_submit_post). For this, you must be logged in using your username/password (click on any lock icon) and authorized to submit changesheets. Click on *Try it out*, and upload your TSV file. Similar to the validation endpoint, you should see a `200` successful response on execution the request. For an example submission changesheet, see [here](https://github.com/microbiomedata/nmdc-runtime/blob/main/metadata-translation/notebooks/data/changesheet-without-separator3.tsv).
4. The fourth and final step in the protocol is to actually submit the changesheet using the submission endpoint from the nmdc-runtime API which you can find [here](https://api.microbiomedata.org/docs#/metadata/submit_changesheet_metadata_changesheets_submit_post). For this, you must be logged in using your username/password (click on any lock icon) and authorized to submit changesheets. Click on *Try it out*, and upload your TSV file. Similar to the validation endpoint, you should see a `200` successful response on execution the request. For an example submission changesheet, see [here](https://github.com/microbiomedata/nmdc-runtime/blob/main/metadata-translation/notebooks/data/changesheet-without-separator3.tsv).

!!! note
The submission endpoint runs the validation endpoint prior to actually submitting the data.
18 changes: 9 additions & 9 deletions docs/howto-guides/claim-and-run-jobs.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Claim and Run Jobs

The Runtime advertises jobs to be done, where a [Job](https://api.dev.microbiomedata.org/docs#/jobs)
is a [Workflow](https://api.dev.microbiomedata.org/docs#/workflows) paired with a chosen input
[Object](https://api.dev.microbiomedata.org/docs#/objects). See [Guide - Create Workflow Triggers To
The Runtime advertises jobs to be done, where a [Job](https://api.microbiomedata.org/docs#/jobs)
is a [Workflow](https://api.microbiomedata.org/docs#/workflows) paired with a chosen input
[Object](https://api.microbiomedata.org/docs#/objects). See [Guide - Create Workflow Triggers To
Spawn Jobs](guide-create-triggers.md) to learn how to arrange for jobs of interest to be
automatically available when relevant new workflow inputs are available.

You can list open jobs via [`GET /jobs`](https://api.dev.microbiomedata.org/docs#/jobs/list_jobs_jobs_get). To
You can list open jobs via [`GET /jobs`](https://api.microbiomedata.org/docs#/jobs/list_jobs_jobs_get). To
claim a job, [`POST` to
`/jobs/{job_id}:claim`](https://api.dev.microbiomedata.org/docs#/jobs/claim_job_jobs__job_id__claim_post). The
response will be an [Operation](https://api.dev.microbiomedata.org/docs#/operations) to track job
`/jobs/{job_id}:claim`](https://api.microbiomedata.org/docs#/jobs/claim_job_jobs__job_id__claim_post). The
response will be an [Operation](https://api.microbiomedata.org/docs#/operations) to track job
execution and send updates to the system.

[`PATCH
/operations/{op_id}`](https://api.dev.microbiomedata.org/docs#/operations/update_operation_operations__op_id__patch)
/operations/{op_id}`](https://api.microbiomedata.org/docs#/operations/update_operation_operations__op_id__patch)
is how to report state transitions for the job execution. If a job execution has been completed
successfully, has failed, or has been aborted, the `done` field for the operation must be set to
`true`.
Expand All @@ -26,11 +26,11 @@ and run jobs are available in the codebase in
submit metadata as Objects and associate them with the `metadata-in` Object Type. This in turn
triggers the creation of Jobs (for the `metadata-in-1.0.0` Workflow) to validate and ingest the
metadata. Because these jobs are not too intensive wrt data or compute, the Runtime itself hosts a
[Site](https://api.dev.microbiomedata.org/docs#/sites) that claims and runs these jobs. *
[Site](https://api.microbiomedata.org/docs#/sites) that claims and runs these jobs. *

* `claim_and_run_apply_changesheet_jobs` senses new jobs to apply changesheets, that is, to apply
surgical updates to existing metadata. Users submit changesheets via [`POST
/metadata/changesheets:submit`](https://api.dev.microbiomedata.org/docs#/metadata/submit_changesheet_metadata_changesheets_submit_post),
/metadata/changesheets:submit`](https://api.microbiomedata.org/docs#/metadata/submit_changesheet_metadata_changesheets_submit_post),
which creates an Object on behalf of the user, annotates it with the `metadata-changesheet` Object
Type. A registered trigger then creates a corresponding `apply-changesheet-1.0.0` job, which this
sensor senses, allowing the Runtime Site to claim and run the job.
Expand Down
14 changes: 7 additions & 7 deletions docs/howto-guides/create-triggers.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Create Workflow Triggers To Spawn Jobs

Jobs represent work to be done. Specifically, a [Job](https://api.dev.microbiomedata.org/docs#/jobs)
is a request to run a [Workflow](https://api.dev.microbiomedata.org/docs#/workflows) given a certain
[Object](https://api.dev.microbiomedata.org/docs#/objects) as its input. The Runtime system will
Jobs represent work to be done. Specifically, a [Job](https://api.microbiomedata.org/docs#/jobs)
is a request to run a [Workflow](https://api.microbiomedata.org/docs#/workflows) given a certain
[Object](https://api.microbiomedata.org/docs#/objects) as its input. The Runtime system will
spawn a new Job when:

1. An [Object](https://api.dev.microbiomedata.org/docs#/objects),
2. is assigned an [Object Type](https://api.dev.microbiomedata.org/docs#/object_types),
3. which is associated with a [Workflow](https://api.dev.microbiomedata.org/docs#/workflows),
4. through a [Trigger](https://api.dev.microbiomedata.org/docs#/triggers).
1. An [Object](https://api.microbiomedata.org/docs#/objects),
2. is assigned an [Object Type](https://api.microbiomedata.org/docs#/object_types),
3. which is associated with a [Workflow](https://api.microbiomedata.org/docs#/workflows),
4. through a [Trigger](https://api.microbiomedata.org/docs#/triggers).

<figure markdown style="max-width: 25em">
![Job Triggering](../img/job-triggering.png)
Expand Down
2 changes: 1 addition & 1 deletion docs/nb/get_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"import requests\n",
"from toolz import keyfilter, merge, concat\n",
"\n",
"HOST = \"https://api.dev.microbiomedata.org\"\n",
"HOST = \"https://api.microbiomedata.org\"\n",
"\n",
"def get_json(path, host=HOST, **kwargs):\n",
" r = requests.get(host + path, **kwargs)\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/nb/queue_and_trigger_data_jobs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"\n",
"assert (\n",
" ENV[\"NMDC_RUNTIME_HOST\"] == \n",
" \"https://api.dev.microbiomedata.org\"\n",
" \"https://api.microbiomedata.org\"\n",
")\n",
"\n",
"HOST = ENV[\"NMDC_RUNTIME_HOST\"]\n",
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Log in as a User

Open <https://api.dev.microbiomedata.org/docs> and click on the `Authorize` button near the top of
Open <https://api.microbiomedata.org/docs> and click on the `Authorize` button near the top of
the page:

![auth button](../img/auth-button.png)
Expand All @@ -22,7 +22,7 @@ Once authorized, hit `Close` to get back to the interactive API documentation:
You need to be already logged in to create a new user.
Also, only users `aclum`, `dwinston`, `scanon`, and `scholia` can create new users at this time.

Go to [POST /users](https://api.dev.microbiomedata.org/docs#/users/create_user_users_post), and
Go to [POST /users](https://api.microbiomedata.org/docs#/users/create_user_users_post), and
click the `Try it out` button. In the request body, the only required fields are `username` and
`password`. If you know the `id`s of any sites you would like the new user to administer, enter
those as an array value for the `site_admin` field.
Expand All @@ -39,7 +39,7 @@ behalf of the site. This is used for managing certain API resources -- rather th
responsible for a resource, a site is, and users that administer the site can come and go.

Once logged in, you can use [GET
/users/me](https://api.dev.microbiomedata.org/docs#/users/read_users_me_users_me__get) to see the
/users/me](https://api.microbiomedata.org/docs#/users/read_users_me_users_me__get) to see the
`id`s of sites you can administer. Example response:

```json
Expand All @@ -54,12 +54,12 @@ Once logged in, you can use [GET
```

You can create your own sites via [POST
/sites](https://api.dev.microbiomedata.org/docs#/sites/create_site_sites_post). If the `id` you
/sites](https://api.microbiomedata.org/docs#/sites/create_site_sites_post). If the `id` you
request already exists, you will get an error response. Do not worry about setting `capability_ids`;
those can be set later.

Once you have identified a site for which to generate credentials, use [POST
/sites/{site_id}:generateCredentials](https://api.dev.microbiomedata.org/docs#/sites/generate_credentials_for_site_client_sites__site_id__generateCredentials_post)
/sites/{site_id}:generateCredentials](https://api.microbiomedata.org/docs#/sites/generate_credentials_for_site_client_sites__site_id__generateCredentials_post)
to do so. The response will look something like

```json
Expand All @@ -73,7 +73,7 @@ Save this information like you saved your username and password.

## Log in as a Site

Click on the `Authorize` button near the top of <https://api.dev.microbiomedata.org/docs>. You may
Click on the `Authorize` button near the top of <https://api.microbiomedata.org/docs>. You may
need to `Logout` first. Scroll all the way down to the second form, the one with only two fields,
`client_id` and `client_secret`:

Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ This represents a set of [nmdc:Biosample](https://microbiomedata.github.io/nmdc-
objects. There is just one, with an `id` of `42`.

Let's validate it. Go to the [POST
/metadata/json:validate](https://api.dev.microbiomedata.org/docs#/metadata/validate_json_metadata_json_validate_post)
endpoint at <https://api.dev.microbiomedata.org/docs> and click "Try it out":
/metadata/json:validate](https://api.microbiomedata.org/docs#/metadata/validate_json_metadata_json_validate_post)
endpoint at <https://api.microbiomedata.org/docs> and click "Try it out":

![Try it Out](../img/validate-json-try-it-out.png)

Expand All @@ -31,14 +31,14 @@ to reproduce the request on the command line:
![Validation Response](../img/validate-json-response.png)

Let's see what a "valid" response looks like. The [GET
/nmdcschema/{collection_name}/{doc_id}](https://api.dev.microbiomedata.org/docs#/metadata/get_from_collection_by_id_nmdcschema__collection_name___doc_id__get)
/nmdcschema/{collection_name}/{doc_id}](https://api.microbiomedata.org/docs#/metadata/get_from_collection_by_id_nmdcschema__collection_name___doc_id__get)
endpoint allows us to get the NMDC-schema-validated JSON object for one of the NMDC metadata
collections:

![Get one valid](../img/validate-json-get-one-valid.png)

For example,
[https://api.dev.microbiomedata.org/nmdcschema/biosample_set/gold:Gb0115217](https://api.dev.microbiomedata.org/nmdcschema/biosample_set/gold:Gb0115217)
[https://api.microbiomedata.org/nmdcschema/biosample_set/gold:Gb0115217](https://api.microbiomedata.org/nmdcschema/biosample_set/gold:Gb0115217)
is

```json
Expand Down Expand Up @@ -129,7 +129,7 @@ Hooray!
## Get a List of NMDC-Schema-Compliant Documents

The [GET
/nmdcschema/{collection_name}](https://api.dev.microbiomedata.org/docs#/metadata/list_from_collection_nmdcschema__collection_name__get)
/nmdcschema/{collection_name}](https://api.microbiomedata.org/docs#/metadata/list_from_collection_nmdcschema__collection_name__get)
endpoint allows you to get a filtered list of documents from one of the NMDC Schema collections:

![List from collections](../img/list-from-collection.png)
Expand All @@ -152,7 +152,7 @@ returned at a time. A much larger `max_page_size` is fine for programs/scripts,
web browser less responsive when using the interactive documentation.

The response body for [our
request](https://api.dev.microbiomedata.org/nmdcschema/biosample_set?filter=%7B%22part_of%22%3A%20%22gold%3AGs0114663%22%7D&max_page_size=20)
request](https://api.microbiomedata.org/nmdcschema/biosample_set?filter=%7B%22part_of%22%3A%20%22gold%3AGs0114663%22%7D&max_page_size=20)
has two fields, `resources` and `next_page_token`:

```json
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/metadata-in.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ $ stat -f "%z bytes" fake_biosample.json
}
```

After a [POST /objects](https://api.dev.microbiomedata.org/docs#/objects/create_object_objects_post)
After a [POST /objects](https://api.microbiomedata.org/docs#/objects/create_object_objects_post)
with the above as the request body, I get back a response object with an `id` that looks like
`sys0***`.

## Annotate the DRS object with the "metadata-in" type

Now, go to [PUT
/objects/{object_id}/types](https://api.dev.microbiomedata.org/docs#/objects/replace_object_types_objects__object_id__types_put)
/objects/{object_id}/types](https://api.microbiomedata.org/docs#/objects/replace_object_types_objects__object_id__types_put)
and ensure the types array for the object is `["metadata-in"]`. This lets the Runtime know that you
intend for this object to be ingested as NMDC metadata.

Expand Down Expand Up @@ -100,7 +100,7 @@ Here's an example of the general Runs view after our new metadata has been inges
![metadata-in-dagit-runs](../img/metadata-in-dagit-runs.png)

And indeed it has been ingested! See
<https://api.dev.microbiomedata.org/nmdcschema/biosample_set/fake> (unless we already deleted it --
<https://api.microbiomedata.org/nmdcschema/biosample_set/fake> (unless we already deleted it --
see section below).

## Removing a JSON document
Expand All @@ -118,7 +118,7 @@ see section below).
Any to-be-deleted documents are backed up to a separate database immediately prior to deletion.

A call to [POST
/queries:run](https://api.dev.microbiomedata.org/docs#/queries/run_query_queries_run_post) with the
/queries:run](https://api.microbiomedata.org/docs#/queries/run_query_queries_run_post) with the
body

```json
Expand Down

0 comments on commit e53dc77

Please sign in to comment.