Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Renames for Openverse API #98

Merged
merged 5 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DOCUMENTATION_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Code examples on how to use the API endpoints. The current API documentation pro
image_stats_bash = \
"""
# Get a list of content providers and their image count
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.creativecommons.engineering/v1/sources
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.openverse.engineering/v1/sources
""" # noqa

@swagger_auto_schema(operation_id='image_stats',
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This repository is primarily concerned with back end infrastructure like datasto

## API Documentation

In the [API documentation](https://api.creativecommons.engineering), you can find more details about the endpoints with examples on how to use them.
In the [API documentation](https://api.openverse.engineering), you can find more details about the endpoints with examples on how to use them.

## How to Run the Server Locally

Expand Down Expand Up @@ -94,7 +94,7 @@ Every week, the latest version of the data is automatically bulk copied ("ingest

### Description of subprojects

- _openverse-api_ is a Django Rest Framework API server. For a full description of its capabilities, please see the [browsable documentation](https://api.creativecommons.engineering).
- _openverse-api_ is a Django Rest Framework API server. For a full description of its capabilities, please see the [browsable documentation](https://api.openverse.engineering).
- _ingestion-server_ is a service for downloading and indexing search data once it has been prepared by the Openverse Catalog
- _analytics_ is a Falcon REST API for collecting usage data.

Expand Down
2 changes: 1 addition & 1 deletion analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ root path (e.g. localhost:8090/). You may have to tweak `docs/redoc.html` for
this to work on your local machine.

Alternatively, you can view the production version of the documentation at
`https://api.creativecommons.engineering/analytics`.
`https://api.openverse.engineering/analytics`.

## Contributing / Code Structure

Expand Down
2 changes: 1 addition & 1 deletion analytics/docs/redoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</style>
</head>
<body>
<redoc spec-url='https://api.creativecommons.engineering/analytics/swagger.yaml'></redoc>
<redoc spec-url='https://api.openverse.engineering/analytics/swagger.yaml'></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
</body>
</html>
8 changes: 4 additions & 4 deletions analytics/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ info:
description: "An API for registering anonymous usage data events in CC Search, which we intend to use to improve the quality of the search results."
version: "1.0.0"
title: "CC Search Usage Data API"
termsOfService: "https://api.creativecommons.engineering/terms_of_service.html"
termsOfService: "https://api.openverse.engineering/terms_of_service.html"
contact:
email: "[email protected]"
license:
name: "MIT License"
url: "https://github.com/wordpress/openverse-api/blob/master/LICENSE"
host: "api.creativecommons.engineering"
host: "api.openverse.engineering"
basePath: "/analytics"
tags:
- name: "Register events"
Expand Down Expand Up @@ -184,5 +184,5 @@ definitions:
description: "The unique identifier for the detail page associated with the event."

externalDocs:
description: "The Creative Commons search API"
url: "https://api.creativecommons.engineering"
description: "The Openverse API"
url: "https://api.openverse.engineering"
zackkrida marked this conversation as resolved.
Show resolved Hide resolved
24 changes: 12 additions & 12 deletions openverse-api/catalog/api/views/image_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,31 +109,31 @@ class SearchImages(APIView):
image_search_bash = \
"""
# Example 1: Search for an exact match of Claude Monet
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q="Claude Monet"
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q="Claude Monet"

# Example 2: Search for images related to both dog and cat
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=dog+cat
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=dog+cat

# Example 3: Search for images related to dog or cat, but not necessarily both
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=dog|cat
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=dog|cat

# Example 4: Search for images related to dog but won't include results related to 'pug'
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=dog -pug
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=dog -pug

# Example 5: Search for images matching anything with the prefix ‘net’
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=net*
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=net*

# Example 6: Search for images that match dogs that are either corgis or labrador
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=dogs + (corgis | labrador)
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=dogs + (corgis | labrador)

# Example 7: Search for images that match strings close to the term theater with a difference of one character
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=theatre~1
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=theatre~1

# Example 8: Search for images using single query parameter
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=test
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=test

# Example 9: Search for images using multiple query parameters
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=test&license=pdm,by&categories=illustration&page_size=1&page=1
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=test&license=pdm,by&categories=illustration&page_size=1&page=1
""" # noqa

@swagger_auto_schema(operation_id='image_search',
Expand Down Expand Up @@ -221,7 +221,7 @@ class RelatedImage(APIView):
recommendations_images_read_bash = \
"""
# Get related images for image ID (7c829a03-fb24-4b57-9b03-65f43ed19395)
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.creativecommons.engineering/v1/recommendations/images/7c829a03-fb24-4b57-9b03-65f43ed19395
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.openverse.engineering/v1/recommendations/images/7c829a03-fb24-4b57-9b03-65f43ed19395
""" # noqa

@swagger_auto_schema(operation_id="recommendations_images_read",
Expand Down Expand Up @@ -299,7 +299,7 @@ class ImageDetail(GenericAPIView, RetrieveModelMixin):
image_detail_bash = \
"""
# Get the details of image ID (7c829a03-fb24-4b57-9b03-65f43ed19395)
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.creativecommons.engineering/v1/images/7c829a03-fb24-4b57-9b03-65f43ed19395
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.openverse.engineering/v1/images/7c829a03-fb24-4b57-9b03-65f43ed19395
""" # noqa

@swagger_auto_schema(operation_id="image_detail",
Expand Down Expand Up @@ -430,7 +430,7 @@ class OembedView(APIView):
oembed_list_bash = \
"""
# Retrieve embedded content from image URL (https://ccsearch.creativecommons.org/photos/7c829a03-fb24-4b57-9b03-65f43ed19395)
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.creativecommons.engineering/v1/oembed?url=https://ccsearch.creativecommons.org/photos/7c829a03-fb24-4b57-9b03-65f43ed19395
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.openverse.engineering/v1/oembed?url=https://ccsearch.creativecommons.org/photos/7c829a03-fb24-4b57-9b03-65f43ed19395
""" # noqa

@swagger_auto_schema(operation_id="oembed_list",
Expand Down
6 changes: 3 additions & 3 deletions openverse-api/catalog/api/views/site_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class ImageStats(APIView):
image_stats_bash = \
"""
# Get a list of content providers and their image count
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.creativecommons.engineering/v1/sources
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.openverse.engineering/v1/sources
""" # noqa

@swagger_auto_schema(operation_id='image_stats',
Expand Down Expand Up @@ -171,7 +171,7 @@ class Register(APIView):
register_api_oauth2_bash = \
"""
# Register for a key
curl -X POST -H "Content-Type: application/json" -d '{"name": "My amazing project", "description": "To access CC Catalog API", "email": "[email protected]"}' https://api.creativecommons.engineering/v1/auth_tokens/register
curl -X POST -H "Content-Type: application/json" -d '{"name": "My amazing project", "description": "To access CC Catalog API", "email": "[email protected]"}' https://api.openverse.engineering/v1/auth_tokens/register
zackkrida marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa

register_api_oauth2_request = openapi.Schema(
Expand Down Expand Up @@ -354,7 +354,7 @@ class CheckRates(APIView):
key_info_bash = \
"""
# Get information about your API key
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.creativecommons.engineering/v1/rate_limit
curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" http://api.openverse.engineering/v1/rate_limit
""" # noqa

@swagger_auto_schema(operation_id='key_info',
Expand Down
18 changes: 9 additions & 9 deletions openverse-api/catalog/example_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"creator": "en:User:Oil&GasIndustry",
"creator_url": "https://en.wikipedia.org/wiki/User:Oil%26GasIndustry",
"url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Well_test_separator.svg",
"thumbnail": "https://api.creativecommons.engineering/v1/thumbs/36537842-b067-4ca0-ad67-e00ff2e06b2d",
"thumbnail": "https://api.openverse.engineering/v1/thumbs/36537842-b067-4ca0-ad67-e00ff2e06b2d",
"provider": "wikimedia",
"source": "wikimedia",
"license": "by",
"license_version": "3.0",
"license_url": "https://creativecommons.org/licenses/by/3.0",
"foreign_landing_url": "https://commons.wikimedia.org/w/index.php?curid=26229990",
"detail_url": "http://api.creativecommons.engineering/v1/images/36537842-b067-4ca0-ad67-e00ff2e06b2d",
"related_url": "http://api.creativecommons.engineering/v1/recommendations/images/36537842-b067-4ca0-ad67-e00ff2e06b2d",
"detail_url": "http://api.openverse.engineering/v1/images/36537842-b067-4ca0-ad67-e00ff2e06b2d",
"related_url": "http://api.openverse.engineering/v1/recommendations/images/36537842-b067-4ca0-ad67-e00ff2e06b2d",
"fields_matched": [
"description",
"title"
Expand Down Expand Up @@ -61,15 +61,15 @@
}
],
"url": "https://live.staticflickr.com/5122/5264886972_3234d62748.jpg",
"thumbnail": "https://api.creativecommons.engineering/v1/thumbs/7c829a03-fb24-4b57-9b03-65f43ed19395",
"thumbnail": "https://api.openverse.engineering/v1/thumbs/7c829a03-fb24-4b57-9b03-65f43ed19395",
"provider": "flickr",
"source": "flickr",
"license": "by",
"license_version": "2.0",
"license_url": "https://creativecommons.org/licenses/by/2.0/",
"foreign_landing_url": "https://www.flickr.com/photos/18090920@N07/5264886972",
"detail_url": "http://api.creativecommons.engineering/v1/images/7c829a03-fb24-4b57-9b03-65f43ed19395",
"related_url": "http://api.creativecommons.engineering/v1/recommendations/images/7c829a03-fb24-4b57-9b03-65f43ed19395",
"detail_url": "http://api.openverse.engineering/v1/images/7c829a03-fb24-4b57-9b03-65f43ed19395",
"related_url": "http://api.openverse.engineering/v1/recommendations/images/7c829a03-fb24-4b57-9b03-65f43ed19395",
"height": 167,
"width": 500,
"attribution": "\"exam test\" by Sean MacEntee is licensed under CC-BY 2.0. To view a copy of this license, visit https://creativecommons.org/licenses/by/2.0/"
Expand Down Expand Up @@ -144,15 +144,15 @@
}
],
"url": "https://live.staticflickr.com/4065/4459771899_07595dc42e.jpg",
"thumbnail": "https://api.creativecommons.engineering/v1/thumbs/610756ec-ae31-4d5e-8f03-8cc52f31b71d",
"thumbnail": "https://api.openverse.engineering/v1/thumbs/610756ec-ae31-4d5e-8f03-8cc52f31b71d",
"provider": "flickr",
"source": "flickr",
"license": "by",
"license_version": "2.0",
"license_url": "https://creativecommons.org/licenses/by/2.0/",
"foreign_landing_url": "https://www.flickr.com/photos/18090920@N07/4459771899",
"detail_url": "http://api.creativecommons.engineering/v1/images/610756ec-ae31-4d5e-8f03-8cc52f31b71d",
"related_url": "http://api.creativecommons.engineering/v1/recommendations/images/610756ec-ae31-4d5e-8f03-8cc52f31b71d"
"detail_url": "http://api.openverse.engineering/v1/images/610756ec-ae31-4d5e-8f03-8cc52f31b71d",
"related_url": "http://api.openverse.engineering/v1/recommendations/images/610756ec-ae31-4d5e-8f03-8cc52f31b71d"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def favorite_images(self):
@task(10)
def shorten_link(self):
_unique = str(uuid.uuid4())
image_link = "http://api-dev.creativecommons.engineering/list/{}"\
image_link = "http://dev.api.openverse.engineering/list/{}"\
.format(_unique)
self.client.post("/link", {"full_url": image_link})

Expand Down
2 changes: 1 addition & 1 deletion openverse-api/catalog/scripts/migration/migrate_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def import_lists_to_catalog(parsed_lists):
'images': _list['images']
}
response = requests.post(
'http://api.creativecommons.engineering/list',
'http://api.openverse.engineering/list',
data=payload
)
if 300 > response.status_code >= 200:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

Optionally rerun the test after the cache has been warmed up.
"""
PROXY_URL = "https://api-dev.creativecommons.engineering/t/600/"
PROXY_URL = "https://dev.api.openverse.engineering/t/600/"

url_queue = gevent.queue.Queue()
provider_counts = defaultdict(int)
Expand Down
10 changes: 5 additions & 5 deletions openverse-api/catalog/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
DEBUG = os.environ.get('DJANGO_DEBUG_ENABLED', default=False) in true_strings

ALLOWED_HOSTS = ['localhost', '127.0.0.1', os.environ.get('LOAD_BALANCER_URL'),
'api-dev.creativecommons.engineering',
"api.creativecommons.engineering",
'dev.api.openverse.engineering',
"api.openverse.engineering",
gethostname(), gethostbyname(gethostname())]

# Domains that shortened links may point to
SHORT_URL_WHITELIST = {
'api-dev.creativecommons.engineering',
'api.creativecommons.engineering',
'dev.api.openverse.engineering',
'api.openverse.engineering',
'ccccatalog.herokuapp.com',
'ccsearch.creativecommons.org',
'localhost:8000'
Expand Down Expand Up @@ -167,7 +167,7 @@
)
# Proxy insecure HTTP images through our internal proxy.
DETAIL_PROXY_URL = os.environ.get(
'DETAIL_PROXY_URL', 'https://api.creativecommons.engineering/t'
'DETAIL_PROXY_URL', 'https://api.openverse.engineering/t'
)

THUMBNAIL_WIDTH_PX = 600
Expand Down
10 changes: 5 additions & 5 deletions openverse-api/catalog/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
Example on how to register for a key

```
$ curl -X POST -H "Content-Type: application/json" -d '{"name": "My amazing project", "description": "To access CC Catalog API", "email": "[email protected]"}' https://api.creativecommons.engineering/v1/auth_tokens/register
$ curl -X POST -H "Content-Type: application/json" -d '{"name": "My amazing project", "description": "To access CC Catalog API", "email": "[email protected]"}' https://api.openverse.engineering/v1/auth_tokens/register
zackkrida marked this conversation as resolved.
Show resolved Hide resolved
```

<br>
Expand All @@ -86,7 +86,7 @@
Example on how to authenticate using OAuth2

```
$ curl -X POST -d "client_id=pm8GMaIXIhkjQ4iDfXLOvVUUcIKGYRnMlZYApbda&client_secret=YhVjvIBc7TuRJSvO2wIi344ez5SEreXLksV7GjalLiKDpxfbiM8qfUb5sNvcwFOhBUVzGNdzmmHvfyt6yU3aGrN6TAbMW8EOkRMOwhyXkN1iDetmzMMcxLVELf00BR2e&grant_type=client_credentials" https://api.creativecommons.engineering/v1/auth_tokens/token/
$ curl -X POST -d "client_id=pm8GMaIXIhkjQ4iDfXLOvVUUcIKGYRnMlZYApbda&client_secret=YhVjvIBc7TuRJSvO2wIi344ez5SEreXLksV7GjalLiKDpxfbiM8qfUb5sNvcwFOhBUVzGNdzmmHvfyt6yU3aGrN6TAbMW8EOkRMOwhyXkN1iDetmzMMcxLVELf00BR2e&grant_type=client_credentials" https://api.openverse.engineering/v1/auth_tokens/token/
```

<br>
Expand Down Expand Up @@ -114,7 +114,7 @@
Example

```
$ curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.creativecommons.engineering/v1/images?q=test
$ curl -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" https://api.openverse.engineering/v1/images?q=test
```
<br>
<blockquote>
Expand Down Expand Up @@ -166,7 +166,7 @@
""" # noqa

logo_url = "https://mirrors.creativecommons.org/presskit/logos/cc.logo.svg"
tos_url = "https://api.creativecommons.engineering/terms_of_service.html"
tos_url = "https://api.openverse.engineering/terms_of_service.html"
license_url =\
"https://github.com/wordpress/openverse-api/blob/master/LICENSE"
schema_view = get_schema_view(
Expand All @@ -189,7 +189,7 @@
report_image_bash = \
"""
# Report an issue about image ID (7c829a03-fb24-4b57-9b03-65f43ed19395)
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" -d '{"reason": "mature", "identifier": "7c829a03-fb24-4b57-9b03-65f43ed19395", "description": "This image contains sensitive content"}' https://api.creativecommons.engineering/v1/images/7c829a03-fb24-4b57-9b03-65f43ed19395/report
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer DLBYIcfnKfolaXKcmMC8RIDCavc2hW" -d '{"reason": "mature", "identifier": "7c829a03-fb24-4b57-9b03-65f43ed19395", "description": "This image contains sensitive content"}' https://api.openverse.engineering/v1/images/7c829a03-fb24-4b57-9b03-65f43ed19395/report
""" # noqa

report_image_request = openapi.Schema(
Expand Down
4 changes: 2 additions & 2 deletions openverse-api/test/api_live_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
API_URL = os.getenv('INTEGRATION_TEST_URL', 'http://localhost:8000')
known_apis = {
'http://localhost:8000': 'LOCAL',
'https://api.creativecommons.engineering': 'PRODUCTION',
'https://api-dev.creativecommons.engineering': 'TESTING'
'https://api.openverse.engineering': 'PRODUCTION',
'https://dev.api.openverse.engineering': 'TESTING'
}


Expand Down
2 changes: 1 addition & 1 deletion openverse-api/test/api_live_search_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
do not accurately model relevance at scale.
"""

API_URL = 'https://api-dev.creativecommons.engineering'
API_URL = 'https://dev.api.openverse.engineering'


def _phrase_in_tags(tags, term):
Expand Down
4 changes: 2 additions & 2 deletions openverse-api/test/v1_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
API_URL = os.getenv('INTEGRATION_TEST_URL', 'http://localhost:8000')
known_apis = {
'http://localhost:8000': 'LOCAL',
'https://api.creativecommons.engineering': 'PRODUCTION',
'https://api-dev.creativecommons.engineering': 'TESTING'
'https://api.openverse.engineering': 'PRODUCTION',
'https://dev.api.openverse.engineering': 'TESTING'
}


Expand Down