menu
Channels
Team

queryString

July 14, 2020 at 4:07pm
Hello!
Im trying to solve this updating the users twitter description and from what i can tell it has to be a percent encoded string. So to test this out im doing the following:
mutation UpdateTwitterDescription($description: String!) {
twitter {
makeRestCall {
post(
path: "/1.1/account/update_profile.json"
queryString: $description
) {
jsonBody
response {
statusCode
}
}
}
}
}
with vairable set as:
{
"description": "Hello%20I'm%20Rich%20Haines.%20I'm%20a…pment.%20%F0%9F%93%A9%20hello%40richardhaines.dev"
}
But its not working. Im unsure how to do this now. I wanted to just encode it in the original call i have where i update the rest of the users info like name and location like so:
mutation UpdateTwitterProfile(
$query: [[String!]!]
) {
twitter {
makeRestCall {
post(
path: "/1.1/account/update_profile.json",
query: $query,
) {
jsonBody
response {
statusCode
}
}
}
}
}
and encode it directly in the query variables:
const query = [
['url', website],
['location', location],
['description', encodeURIComponent(description)],
['name', name]
].filter((row) => Boolean(row[1]));
But that doesnt work either.
Does anyone have any ideas as to what im doing wring here?

July 14, 2020 at 4:12pm
What error do you get when you run the mutations?
  • reply
  • like
The classic:
  • reply
  • like
code: 32, message: "Could not authenticate you."
  • reply
  • like
which basically means there is something wrong in the request
  • reply
  • like
I've narrowed the problem down to a bug in our URI parsing library, where it doesn't handle "@" properly.
I'm working on a fix and will provide an update here when it's ready.
like-fill
1
  • reply
  • like
Oh sweet! Thank you. Which of my solutions is wrong/right then? Can i just encode the string an pass it to the query array? Or do i have to use a quesryString and to a seperate mutation for just the description?
  • reply
  • like
Also, in some of my test i dont use @, I have tested with ''' and that doesnt work either
  • reply
  • like
I've just pushed up a fix. I was wrong about it being an issue in the Uri library, it was actually a bug in how we encoded fields for the Oauth1 header.
Your second query will work, but you don't have to encode the query parameters when you construct the query params.
query:
mutation UpdateTwitterProfile(
$query: [[String!]!]
) {
twitter {
makeRestCall {
post(
path: "/1.1/account/update_profile.json",
query: $query,
) {
jsonBody
response {
statusCode
}
}
}
}
}
params:
{"query": [["description", "Hello I'm Rich Haines. I'm a…pment. 📩 [email protected]"]]}
like-fill
1
  • reply
  • like
Amazing! Thank you! This pushes me close to a beta launch, really appreciate you taking the time to fix this
like-fill
2
  • reply
  • like