we have a delete-rpc
request defined in a proto as
rpc DeleteTag(DeleteTagRequest) returns (DeleteTagResponse) {
option (google.api.http).delete = "/v2/tags";
}
message DeleteTagRequest {
Tag.Type tag_type = 1; // Tag to delete.
}
message DeleteTagResponse {}
message Tag {
string id = 1; // Tag ID.
Type type = 2; // Tag type.
google.protobuf.BoolValue enabled = 3;
}
enum Type {
UNKNOWN = 0; // Illegal default value, exception will be thrown if used
GOOGLE_ADS = 1;
GOOGLE_ANALYTICS = 2;
YANDEX_METRICA = 3;
FACEBOOK_PIXEL = 4;
GOOGLE_TAG_MANAGER = 5;
}
Calling the API using RPC works perfectly fine, but when I'm trying to call this endpoint via REST using Postman, it fails with http code 428 (Precondition required).
I'm using a DELETE
method with the following json-raw-body:
{
"tag_type": "GOOGLE_ANALYTICS"
}
I keep getting 428 back with the message "tag type is required, found UNKNOWN."
I tried changing the request and sending in with different parameters multiple times and even tried to change the proto, but none of my efforts were fruitful.
Any ideas what am I doing wrong?
CodePudding user response:
Apparently, when sending a DELETE request we need to pass the parameters as query-params and not as the body-params like some RPC docssuggested.
curl -X DELETE \
'https://www.example.com/v2/tags?tag_type=GOOGLE_ANALYTICS' \
-H 'authorization: <AUTH>