jolicode/slack-php-api

Request-URI Too Large

Closed this issue · 4 comments

Some API methods such as views.publish require a large payload and as a result - can fail with Request-URI Too Large. Is there a way to have the client send as HTTP POST with either form values or JSON encoded body? Slack API supports both of these options. Using the Slack Web API

Slack document this method as "GET":

"/views.publish": {
"get": {
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"description": "Publish a static view for a User.",
"externalDocs": {
"description": "API method documentation",
"url": "https://api.slack.com/methods/views.publish"
},
"operationId": "views_publish",
"parameters": [
{
"description": "Authentication token. Requires scope: `none`",
"in": "header",
"name": "token",
"required": true,
"type": "string"
},
{
"description": "`id` of the user you want publish a view to.",
"in": "query",
"name": "user_id",
"required": true,
"type": "string"
},
{
"description": "A [view payload](/reference/surfaces/views). This must be a JSON-encoded string.",
"in": "query",
"name": "view",
"required": true,
"type": "string"
},
{
"description": "A string that represents view state to protect against possible race conditions.",
"in": "query",
"name": "hash",
"type": "string"
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "Typical success response includes the published view payload.",
"schema": {
"additionalProperties": true,
"description": "This method either only returns a brief _OK_ response or a verbose schema is not available for this method.",
"properties": {
"ok": {
"$ref": "#/definitions/defs_ok_true"
}
},
"required": [
"ok"
],
"title": "Default success template",
"type": "object"
}
},
"default": {
"description": "Typical error response, before getting to any possible validation errors.",
"schema": {
"additionalProperties": true,
"description": "This method either only returns a brief _not OK_ response or a verbose schema is not available for this method.",
"properties": {
"ok": {
"$ref": "#/definitions/defs_ok_false"
}
},
"required": [
"ok"
],
"title": "Default error template",
"type": "object"
}
}
},
"security": [
{
"slackAuth": [
"none"
]
}
],
"tags": [
"views"
]
}
},

Because https://github.com/slackapi/slack-api-specs has so much issues, we have a patch system in place to edit the specification when needed. But this change would be a big one, may I suggest you open an issue on https://github.com/slackapi/slack-api-specs too?

Also here is the documentation about our patch system https://github.com/jolicode/slack-php-api/blob/master/doc/updating-sdk.md is you wanna submit a PR about this 😉

Thanks a lot

@gmcmicken Did you happen to open an issue on https://github.com/slackapi/slack-api-specs? This is a major issue for one of our implementations and I'll go ahead and take the reins to resolve this issue if need be.

No sorry I didn't have the time to pursue this one. Thanks @ryneandal

One interesting note is that I cannot replicate this in our "dev" environment, which is just a free-tier Slack organization that has little to no API call volume. I'm using the same payload and functionality, yet it posts with no issue.

I'm wondering if this is somehow related to the number of requests our production environment makes.