API Testing
pdf
keyboard_arrow_up
School
Stanford University *
*We aren’t endorsed by this school
Course
142
Subject
Information Systems
Date
Dec 6, 2023
Type
Pages
15
Uploaded by BarristerLyrebirdPerson821
http://localhost:8080/register-client
http://localhost:8080/upload-doc?network-id=MNV1697588167620&document-name=my%20fifth%20doc&user-i
d=user04
HEADERS
Content-Type
multipart/form-data
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20doc
user-id
user04
Body
formdata
API Testing
This is a collection of the different API calls we made to all 9 endpoints within our service. We used these tests to validate
the proper functionality of our service. We tested it such that every controllable request message was sent back through
postman.
POST
http://localhost:8080/register-client
Exercises the /register-client endpoint. This endpoint MUST be called first in the lifetime of a client app, the result from
this API call is used in all subsequent API calls, it is expected that the client would store the result for future API calls.
POST
http://localhost:8080/upload-doc?network-id=testCollectionDocs&document-
name=my%20first%20doc&user-id=user01
Exercises the /upload-doc endpoint. Successfully uploads the selected file to MNV1697588167620's collection in the
database. Labels a single user as owner for the document.
contents
http://localhost:8080/upload-doc?network-id=MNV1697588167620&document-name=my%20seventh%20doc&u
ser-id=user01/user04
HEADERS
Content-Type
multipart/form-data
PARAMS
network-id
MNV1697588167620
document-name
my%20seventh%20doc
user-id
user01/user04
Body
formdata
contents
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-name=my%20first%20doc&your-
user-id=user01
POST
http://localhost:8080/upload-doc?network-id=MNV1697588167620&document-
name=my%20seventh%20doc&user-id=user01/user04
Exercises the /upload-doc endpoint. Successfully uploads the selected file to MNV1697588167620's collection in the
database. Labels two users as owner for the document.
GET
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-
name=my%20first%20doc&your-user-id=user01
Exercises the /download-doc endpoint. Successfully retrieves the document's contents from the database and returns it
to postman.
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user01
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-name=my%20first%20doc&your-
user-id=user06
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user06
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-name=my%20ninth%20doc&you
r-user-id=user06
PARAMS
network-id
testCollectionDocs
document-name
my%20ninth%20doc
your-user-id
user06
GET
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-
name=my%20first%20doc&your-user-id=user06
Exercises the /download-doc endpoint. Fails to retrieve the document's contents from the database and returns it to
postman, the message "You do not have ownership of this document" is returned instead.
GET
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-
name=my%20ninth%20doc&your-user-id=user06
Exercises the /download-doc endpoint. Fails to retrieve the document's contents from the database and returns it to
postman, the message "No such document exists" is returned instead.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-name=my%20first%20doc&your-
user-id=user06
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user06
Body
raw (json)
GET
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-
name=my%20first%20doc&your-user-id=user06
Exercises the /download-doc endpoint. Uses the optional JSON RequestBody to bypass normal restrictions considering
you already have the document in JSON format, successfully retrieves the contents and returns it to postman.
json
{
"clientId"
: "testCollectionDocs"
,
"wordCount"
: 9
,
"docId"
: "docXML1697585189167"
,
"previousVersions"
: [
{
"clientId"
: ""
,
"wordCount"
: 0
,
"docId"
: ""
,
"title"
: ""
,
"userId"
: ""
,
"fileString"
: "#"
},
{
"clientId"
: "testCollectionDocs"
,
"wordCount"
: 6
,
"docId"
: "docXML1697585189167"
,
"title"
: "my first doc"
,
"userId"
: "user01"
,
"fileString"
: "#VGhpcyBpcyBteSBmaXJzdCBkb2N1bWVudCB3b29ob28h"
},
{
"clientId"
: "testCollectionDocs"
,
"wordCount"
: 8
,
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-name=my%20first%20doc&your-
user-id=user06
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user06
Body
raw
http://localhost:8080/check-for-doc?network-id=testCollectionDocs&document-name=my%20first%20doc&your-
user-id=user01
"docId"
: "docXML1697585189167"
,
"title"
: "my first doc"
,
"userId"
: "user01"
,
"fileString"
: "#VGhpcyBpcyBteSBmaXJzdCBkb2N1bWVudCB3b29ob28hDQoNCnNlY29uZCE="
}
],
"title"
: "my first doc"
,
"userId"
: "user01"
,
"fileString"
: "#VGhpcyBpcyBteSBmaXJzdCBkb2N1bWVudCB3b29ob28hDQoNCnNlY29uZCEgdGhpcmQh"
}
GET
http://localhost:8080/download-doc?network-id=testCollectionDocs&document-
name=my%20first%20doc&your-user-id=user06
Exercises the /download-doc endpoint. Uses the optional JSON RequestBody to bypass normal restrictions considering
you already have the document in JSON format, unsuccessfully retrieves the contents due to a malformed JSON body and
returns "The request body is malformed" to postman.
{
}
GET
http://localhost:8080/check-for-doc?network-id=testCollectionDocs&document-
name=my%20first%20doc&your-user-id=user01
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user01
http://localhost:8080/check-for-doc?network-id=testCollectionDocs&document-name=my%20first%20doc&your-
user-id=user05
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user05
http://localhost:8080/check-for-doc?network-id=testCollectionDocs&document-name=my%20first%20docs&your
-user-id=user01
PARAMS
network-id
testCollectionDocs
f
Exercises the /check-for-doc endpoint. Successfully retrieves the document from the databases and returns it in a
serialized JSON string to postman.
GET
http://localhost:8080/check-for-doc?network-id=testCollectionDocs&document-
name=my%20first%20doc&your-user-id=user05
Exercises the /check-for-doc endpoint. Unsuccessfully retrieves the document from the databases and returns "Your user
does not have access to this document" to postman.
GET
http://localhost:8080/check-for-doc?network-id=testCollectionDocs&document-
name=my%20first%20docs&your-user-id=user01
Exercises the /check-for-doc endpoint. Unsuccessfully retrieves the document from the databases and returns "No such
document exists" to postman.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
document-name
my%20first%20docs
your-user-id
user01
http://localhost:8080/see-previous-version?network-id=testCollectionDocs&document-name=my%20first%20do
c&your-user-id=user04&revision-number=2
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user04
revision-number
2
http://localhost:8080/see-previous-version?network-id=testCollectionDocs&document-name=my%20first%20do
c&your-user-id=user01&revision-number=-1
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
id
01
GET
http://localhost:8080/see-previous-version?network-
id=testCollectionDocs&document-name=my%20first%20doc&your-user-
id=user01&revision-number=-1
Exercises the /see-previous-version endpoint Fails to retrieve a previous version of the requested document "Your user
does not have access to this document" is returned to postman.
GET
http://localhost:8080/see-previous-version?network-
id=testCollectionDocs&document-name=my%20first%20doc&your-user-
id=user01&revision-number=-1
Exercises the /see-previous-version endpoint Fails to retrieve a previous version of the requested document "This is not a
valid revision number" is returned to postman.
your-user-id
user01
revision-number
±1
http://localhost:8080/see-previous-version?network-id=testCollectionDocs&document-name=my%20first%20do
cs&your-user-id=user01&revision-number=2
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20docs
your-user-id
user01
revision-number
2
http://localhost:8080/see-previous-version?network-id=testCollectionDocs&document-name=my%20first%20do
c&your-user-id=user01&revision-number=2
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
id
01
GET
http://localhost:8080/see-previous-version?network-
id=testCollectionDocs&document-name=my%20first%20docs&your-user-
id=user01&revision-number=2
Exercises the /see-previous-version endpoint Fails to retrieve a previous version of the requested document "No such
document exists" is returned to postman.
GET
http://localhost:8080/see-previous-version?network-
id=testCollectionDocs&document-name=my%20first%20doc&your-user-
id=user01&revision-number=2
Exercises the /see-previous-version endpoint Successfully retrieves the previous version of the document and returns it
as JSON string to postman.
your-user-id
user01
revision-number
2
http://localhost:8080/share-document?network-id=MNV1697588167620&document-name=my%20fifth%20doc&
your-user-id=user04&their-user-id=user01
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20doc
your-user-id
user04
their-user-id
user01
http://localhost:8080/share-document?network-id=MNV1697588167620&document-name=my%20fifth%20doc&
your-user-id=user05&their-user-id=user02
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20doc
PATCH
http://localhost:8080/share-document?network-
id=MNV1697588167620&document-name=my%20fifth%20doc&your-user-
id=user04&their-user-id=user01
Exercises the /share-document endpoint. Successfully shares the document with the desired user by concatenating their
userId to the userId string on the document. "The document has been shared with the desired user" is returned to
postman.
PATCH
http://localhost:8080/share-document?network-
id=MNV1697588167620&document-name=my%20fifth%20doc&your-user-
id=user05&their-user-id=user02
Exercises the /share-document endpoint. Unsuccessfully shares the document with the desired user. "Your user does not
have access to this document" is returned to postman.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
your-user-id
user05
their-user-id
user02
http://localhost:8080/share-document?network-id=MNV1697588167620&document-name=my%20fifth%20doc&
your-user-id=user04&their-user-id=user01
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20doc
your-user-id
user04
their-user-id
user01
http://localhost:8080/share-document?network-id=MNV1697588167620&document-name=my%20fifth%20doc&
your-user-id=user01&their-user-id=user02
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20doc
PATCH
http://localhost:8080/share-document?network-
id=MNV1697588167620&document-name=my%20fifth%20doc&your-user-
id=user04&their-user-id=user01
Exercises the /share-document endpoint. Unsuccessfully shares the document with the desired user. "This document has
already been shared with the desired user" is returned to postman.
PATCH
http://localhost:8080/share-document?network-
id=MNV1697588167620&document-name=my%20fifth%20doc&your-user-
id=user01&their-user-id=user02
Exercises the /share-document endpoint. Successfully shares the document with the desired user by concatenating their
userId to the userId string on the document. "The document has been shared with the desired user" is returned to
postman. This is meant to demonstrate that users who had recently been added can share as well.
your-user-id
user01
their-user-id
user02
http://localhost:8080/share-document?network-id=MNV1697588167620&document-name=my%20fifth%20docs
&your-user-id=user01&their-user-id=user02
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20docs
your-user-id
user01
their-user-id
user02
http://localhost:8080/see-document-stats?network-id=testCollectionDocs&document-name=my%20first%20doc
&your-user-id=user01
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user01
PATCH
http://localhost:8080/share-document?network-
id=MNV1697588167620&document-name=my%20fifth%20docs&your-user-
id=user01&their-user-id=user02
Exercises the /share-document endpoint. Unsuccessfully shares the document with the desired user. "no such document
exists" is returned to postman.
GET
http://localhost:8080/see-document-stats?network-
id=testCollectionDocs&document-name=my%20first%20doc&your-user-
id=user01
Exercises the /see-document-stats endpoint/ Successfully returns the document stats to postman.
http://localhost:8080/see-document-stats?network-id=testCollectionDocs&document-name=my%20first%20doc
&your-user-id=user03
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20doc
your-user-id
user03
http://localhost:8080/see-document-stats?network-id=testCollectionDocs&document-name=my%20first%20doc
s&your-user-id=user01
PARAMS
network-id
testCollectionDocs
document-name
my%20first%20docs
your-user-id
user01
GET
http://localhost:8080/see-document-stats?network-
id=testCollectionDocs&document-name=my%20first%20doc&your-user-
id=user03
Exercises the /see-document-stats endpoint/ Unsuccessfully returns the document stats to postman instead "Your user
does not have access to this document" is returned.
GET
http://localhost:8080/see-document-stats?network-
id=testCollectionDocs&document-name=my%20first%20docs&your-user-
id=user01
Exercises the /see-document-stats endpoint/ Unsuccessfully returns the document stats to postman instead "no such
document exists" is returned.
GET
http://localhost:8080/generate-difference-summary?network-
id=testCollectionDocs&first-document-name=my%20first%20doc&second-
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
http://localhost:8080/generate-difference-summary?network-id=testCollectionDocs&fst-doc-name=my%20first%
20doc&snd-doc-name=my%20fifth%20doc&your-user-id=user01
PARAMS
network-id
testCollectionDocs
fst-doc-name
my%20first%20doc
snd-doc-name
my%20fifth%20doc
your-user-id
user01
http://localhost:8080/generate-difference-summary?network-id=testCollectionDocs&fst-doc-name=my%20first%
20doc&snd-doc-name=my%20fifth%20doc&your-user-id=user04
PARAMS
network-id
testCollectionDocs
fst-doc-name
my%20first%20doc
snd-doc-name
my%20fifth%20doc
your-user-id
user04
document-name=my%20fifth%20doc&your-user-id=user01
Exercises the /generate-difference-summary endpoint. Successfully returns the difference summary to postman.
GET
http://localhost:8080/generate-difference-summary?network-
id=testCollectionDocs&first-document-name=my%20first%20doc&second-
document-name=my%20fifth%20doc&your-user-id=user04
Exercises the /generate-difference-summary endpoint. Unsuccessfully returns the difference summary to postman
instead "Your user does not have access to one of the documents" is returned.
GET
http://localhost:8080/generate-difference-summary?network-
id=testCollectionDocs&first-document-name=my%20first%20doc&second-
document-name=my%20zero%20doc&your-user-id=user04
http://localhost:8080/generate-difference-summary?network-id=testCollectionDocs&fst-doc-name=my%20first%
20doc&snd-doc-name=my%20zero%20doc&your-user-id=user04
PARAMS
network-id
testCollectionDocs
fst-doc-name
my%20first%20doc
snd-doc-name
my%20zero%20doc
your-user-id
user04
http://localhost:8080/delete-doc?network-id=MNV1697588167620&document-name=my%20fifth%20docs&your-
user-id=user04
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20docs
your-user-id
user04
http://localhost:8080/delete-doc?network-id=MNV1697588167620&document-name=my%20fifth%20doc&your-u
ser-id=user08
Exercises the /generate-difference-summary endpoint. Unsuccessfully returns the difference summary to postman
instead "One or more of the documents does not exist" is returned.
DELETE
http://localhost:8080/delete-doc?network-
id=MNV1697588167620&document-name=my%20fifth%20docs&your-user-
id=user04
Exercises the /delete-doc endpoint. Unsuccesfully deletes the document from the database "no such document exists" is
returned to postman.
DELETE
http://localhost:8080/delete-doc?network-
id=MNV1697588167620&document-name=my%20fifth%20doc&your-user-
id=user08
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20doc
your-user-id
user08
http://localhost:8080/delete-doc?network-id=MNV1697588167620&document-name=my%20fifth%20doc&your-u
ser-id=user04
PARAMS
network-id
MNV1697588167620
document-name
my%20fifth%20doc
your-user-id
user04
http://localhost:8080/retrieve-docs?network-id=testCollectionDocs&user-id=yourUserId
PARAMS
network-id
testCollectionDocs
user-id
yourUserId
Exercises the /delete-doc endpoint. Unsuccesfully deletes the document from the database "Your user does not have
ownership of this document" is returned to postman.
DELETE
http://localhost:8080/delete-doc?network-
id=MNV1697588167620&document-name=my%20fifth%20doc&your-user-
id=user04
Exercises the /delete-doc endpoint. Succesfully deletes the document from the database "Your document was
successfully deleted" is returned to postman.
GET
http://localhost:8080/retrieve-docs?network-id=testCollectionDocs&user-
id=yourUserId
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help