Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update merge subject api python example for #2519 #2632

Merged
merged 1 commit into from
Feb 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions backend/app/controllers/merge_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ class ArchivesSpaceService < Sinatra::Base
end
.example('python') do
<<~PYTHON
from asnake.client import ASnakeClient
client = ASnakeClient(baseurl=as_api, username=as_un, password=as_pw)
client.authorize()
from asnake.client import ASnakeClient # import the ArchivesSnake client

client = ASnakeClient(baseurl="http://localhost:8089", username="admin", password="admin")
# replace http://localhost:8089 with your ArchivesSpace API URL and admin for your username and password

client.authorize() # authorizes the client

updated_json = {'uri': 'merge_requests/subject',
'target': {'ref': subject_merge},
'victims': [{'ref': subject_uri}]}
'target': {'ref': subject_merge_into},
'victims': [{'ref': subject_uri_to_merge}]}
# replace subject_merge_into for the URI of the subject you want to merge into and subject_uri_to_merge with the
# URI of the subject you want merged, i.e. subject_uri_to_merge >> subject_merge_into

merge_response = client.post('merge_requests/subject', json=updated_json)
print(merge_response.json())
# capture the response of the merge request

print(merge_response.json()) # For error handling, you can print the response of the merge request
PYTHON
end
.returns([200, :updated]) \
Expand Down