forked from Qortal/qortal
Removed /arbitrary PUT and PATCH API endpoints.
It's best to let the core decide which one to use now that it is able to.
This commit is contained in:
parent
6c995ed738
commit
332b874493
@ -296,78 +296,6 @@ public class ArbitraryResource {
|
|||||||
return this.upload(null, Service.valueOf(serviceString), name, null, path);
|
return this.upload(null, Service.valueOf(serviceString), name, null, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
|
||||||
@Path("/{service}/{name}")
|
|
||||||
@Operation(
|
|
||||||
summary = "Build raw, unsigned, ARBITRARY transaction, based on a user-supplied path, using the PUT method",
|
|
||||||
description = "A PUT transaction replaces the data held for this name and service in its entirety.",
|
|
||||||
requestBody = @RequestBody(
|
|
||||||
required = true,
|
|
||||||
content = @Content(
|
|
||||||
mediaType = MediaType.TEXT_PLAIN,
|
|
||||||
schema = @Schema(
|
|
||||||
type = "string", example = "/Users/user/Documents/MyDirectoryOrFile"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
responses = {
|
|
||||||
@ApiResponse(
|
|
||||||
description = "raw, unsigned, ARBITRARY transaction encoded in Base58",
|
|
||||||
content = @Content(
|
|
||||||
mediaType = MediaType.TEXT_PLAIN,
|
|
||||||
schema = @Schema(
|
|
||||||
type = "string"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@SecurityRequirement(name = "apiKey")
|
|
||||||
public String put(@PathParam("service") String serviceString,
|
|
||||||
@PathParam("name") String name,
|
|
||||||
String path) {
|
|
||||||
Security.checkApiCallAllowed(request);
|
|
||||||
|
|
||||||
return this.upload(Method.PUT, Service.valueOf(serviceString), name, null, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PATCH
|
|
||||||
@Path("/{service}/{name}")
|
|
||||||
@Operation(
|
|
||||||
summary = "Build raw, unsigned, ARBITRARY transaction, based on a user-supplied path, using the PATCH method",
|
|
||||||
description = "A PATCH transaction calculates the delta between the current state on the on-chain state, " +
|
|
||||||
"and then publishes only the differences.",
|
|
||||||
requestBody = @RequestBody(
|
|
||||||
required = true,
|
|
||||||
content = @Content(
|
|
||||||
mediaType = MediaType.TEXT_PLAIN,
|
|
||||||
schema = @Schema(
|
|
||||||
type = "string", example = "/Users/user/Documents/MyDirectoryOrFile"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
responses = {
|
|
||||||
@ApiResponse(
|
|
||||||
description = "raw, unsigned, ARBITRARY transaction encoded in Base58",
|
|
||||||
content = @Content(
|
|
||||||
mediaType = MediaType.TEXT_PLAIN,
|
|
||||||
schema = @Schema(
|
|
||||||
type = "string"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@SecurityRequirement(name = "apiKey")
|
|
||||||
public String patch(@PathParam("service") String serviceString,
|
|
||||||
@PathParam("name") String name,
|
|
||||||
String path) {
|
|
||||||
Security.checkApiCallAllowed(request);
|
|
||||||
|
|
||||||
return this.upload(Method.PATCH, Service.valueOf(serviceString), name, null, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/{service}/{name}/{identifier}")
|
@Path("/{service}/{name}/{identifier}")
|
||||||
@Operation(
|
@Operation(
|
||||||
@ -404,80 +332,6 @@ public class ArbitraryResource {
|
|||||||
return this.upload(null, Service.valueOf(serviceString), name, identifier, path);
|
return this.upload(null, Service.valueOf(serviceString), name, identifier, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
|
||||||
@Path("/{service}/{name}/{identifier}")
|
|
||||||
@Operation(
|
|
||||||
summary = "Build raw, unsigned, ARBITRARY transaction, based on a user-supplied path, using the PUT method",
|
|
||||||
description = "A PUT transaction replaces the data held for this name and service in its entirety.",
|
|
||||||
requestBody = @RequestBody(
|
|
||||||
required = true,
|
|
||||||
content = @Content(
|
|
||||||
mediaType = MediaType.TEXT_PLAIN,
|
|
||||||
schema = @Schema(
|
|
||||||
type = "string", example = "/Users/user/Documents/MyDirectoryOrFile"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
responses = {
|
|
||||||
@ApiResponse(
|
|
||||||
description = "raw, unsigned, ARBITRARY transaction encoded in Base58",
|
|
||||||
content = @Content(
|
|
||||||
mediaType = MediaType.TEXT_PLAIN,
|
|
||||||
schema = @Schema(
|
|
||||||
type = "string"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@SecurityRequirement(name = "apiKey")
|
|
||||||
public String put(@PathParam("service") String serviceString,
|
|
||||||
@PathParam("name") String name,
|
|
||||||
@PathParam("identifier") String identifier,
|
|
||||||
String path) {
|
|
||||||
Security.checkApiCallAllowed(request);
|
|
||||||
|
|
||||||
return this.upload(Method.PUT, Service.valueOf(serviceString), name, identifier, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PATCH
|
|
||||||
@Path("/{service}/{name}/{identifier}")
|
|
||||||
@Operation(
|
|
||||||
summary = "Build raw, unsigned, ARBITRARY transaction, based on a user-supplied path, using the PATCH method",
|
|
||||||
description = "A PATCH transaction calculates the delta between the current state on the on-chain state, " +
|
|
||||||
"and then publishes only the differences.",
|
|
||||||
requestBody = @RequestBody(
|
|
||||||
required = true,
|
|
||||||
content = @Content(
|
|
||||||
mediaType = MediaType.TEXT_PLAIN,
|
|
||||||
schema = @Schema(
|
|
||||||
type = "string", example = "/Users/user/Documents/MyDirectoryOrFile"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
responses = {
|
|
||||||
@ApiResponse(
|
|
||||||
description = "raw, unsigned, ARBITRARY transaction encoded in Base58",
|
|
||||||
content = @Content(
|
|
||||||
mediaType = MediaType.TEXT_PLAIN,
|
|
||||||
schema = @Schema(
|
|
||||||
type = "string"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@SecurityRequirement(name = "apiKey")
|
|
||||||
public String patch(@PathParam("service") String serviceString,
|
|
||||||
@PathParam("name") String name,
|
|
||||||
@PathParam("identifier") String identifier,
|
|
||||||
String path) {
|
|
||||||
Security.checkApiCallAllowed(request);
|
|
||||||
|
|
||||||
return this.upload(Method.PATCH, Service.valueOf(serviceString), name, identifier, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private String upload(Method method, Service service, String name, String identifier, String path) {
|
private String upload(Method method, Service service, String name, String identifier, String path) {
|
||||||
// Fetch public key from registered name
|
// Fetch public key from registered name
|
||||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||||
|
@ -8,7 +8,7 @@ if [ -z "$*" ]; then
|
|||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo
|
echo
|
||||||
echo "Host/update data:"
|
echo "Host/update data:"
|
||||||
echo "qdata [POST/PUT/PATCH] [service] [name] [dirpath] <identifier>"
|
echo "qdata POST [service] [name] [dirpath] <identifier>"
|
||||||
echo
|
echo
|
||||||
echo "Fetch data:"
|
echo "Fetch data:"
|
||||||
echo "qdata GET [service] [name] <identifier-or-default> <filepath-or-default> <rebuild>"
|
echo "qdata GET [service] [name] <identifier-or-default> <filepath-or-default> <rebuild>"
|
||||||
@ -36,7 +36,7 @@ if [ -z "${name}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "${method}" == "POST" || "${method}" == "PUT" || "${method}" == "PATCH" ]]; then
|
if [[ "${method}" == "POST" ]]; then
|
||||||
directory=$4
|
directory=$4
|
||||||
identifier=$5
|
identifier=$5
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user