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

Implement mint legacy api endpoints #2201

Merged
merged 8 commits into from
May 31, 2024
10 changes: 10 additions & 0 deletions config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ module.exports.routes = {
action: 'harvest',
csrf: false
},
'post /:branding/:portal/api/mint/harvest/:recordType': {
controller: 'webservice/RecordController',
action: 'legacyHarvest',
csrf: false
},
'get /:branding/:portal/api/mint/harvest/search': {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need the ingest harvest. Search will be performed with existing endpoints already covered in the first work package. Future work package will cover getting the form components that search legacy Mint to be able to find the records inside ReDBox.

controller: 'webservice/RecordController',
action: 'getHarvestRecord',
csrf: false
},
'put /:branding/:portal/api/records/objectmetadata/:oid': {
controller: 'webservice/RecordController',
action: 'updateObjectMeta',
Expand Down
1 change: 0 additions & 1 deletion config/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,4 @@ module.exports.workflow = {
consolidated: true
}
}

};
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
meta {
name: Create HARVEST Legacy Record
type: http
seq: 32
}

post {
url: {{host}}/default/rdmp/api/mint/harvest/rdmp
body: json
auth: none
}

headers {
Content-Type: application/json
Authorization: Bearer {{token}}
}

body:json {
{
"records": [
{
"harvest_id": "s123456",
"metadata": {
"data": {
"ID": "s123456",
"GIVEN_NAME": "Andrew",
"OTHER_NAMES": "",
"FAMILY_NAME": "S",
"PREF_NAME": "",
"HONORIFIC": "",
"EMAIL": "[email protected]",
"JOB_TITLE": "Assistant Professor",
"URI": "",
"NLA_PARTY_IDENTIFIER": "",
"ORCID": "0000-0001-7269-2286",
"PERSONAL_HOMEPAGE": "",
"STAFF_PROFILE_HOMEPAGE": "",
"DESCRIPTION": "",
"RESEARCH_ELEMENTS_USER_ID": "12345678"
}
}
}
]
}
}

tests {

test("Status code is 200", function () {
expect(res.getStatus()).to.equal(200);
});

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
meta {
name: Create HARVEST Record
type: http
seq: 33
}

post {
url: {{host}}/default/rdmp/api/records/harvest/rdmp
body: json
auth: none
}

headers {
Content-Type: application/json
Authorization: Bearer {{token}}
}

body:json {
{
"records": [
{
"harvestId": "s123456",
"recordRequest": {
"metadata": {
"ID": "s123456",
"GIVEN_NAME": "Andrew",
"OTHER_NAMES": "",
"FAMILY_NAME": "S",
"PREF_NAME": "",
"HONORIFIC": "",
"EMAIL": "[email protected]",
"JOB_TITLE": "Assistant Professor",
"URI": "",
"NLA_PARTY_IDENTIFIER": "",
"ORCID": "0000-0001-7269-2286",
"PERSONAL_HOMEPAGE": "",
"STAFF_PROFILE_HOMEPAGE": "",
"DESCRIPTION": "",
"RESEARCH_ELEMENTS_USER_ID": "12345678"
}
}
}
]
}
}

tests {

test("Status code is 200", function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some tests that check the response body is structured correctly?

expect(res.getStatus()).to.equal(200);
});

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
meta {
name: Get HARVEST Record-s Metadata
type: http
seq: 34
}

get {
url: {{host}}/default/rdmp/api/mint/harvest/search?harvestId=s123456&recordType=rdmp
body: none
auth: none
}

headers {
Authorization: Bearer {{token}}
~:
}

tests {
test("Status code is 200", function () {
expect(res.getStatus()).to.equal(200);
});

test("ID is correct", function () {
var jsonData = res.getBody();
expect(jsonData.ID).to.eql("s123456");
});
}
Loading
Loading