Repository navigation
Jquery Ajax call to API:Links:Update returns "Error 500" on server, #984
Replies: 2 comments · 6 replies
|
Hm, I can't reproduce this when calling the endpoint via curl. curl --request PATCH \
--url https://demo.linkace.org/api/v2/links/88 \
--header 'accept: application/json' \
--header 'authorization: Bearer 4|dj62zfDUnskyMysYEoWL2DoFET7DyWmRWxEDQpwd38ee7558' \
--header 'content-type: application/json' \
--data '{
"url": "https://cloudhiker.net",
"title": "Cloudhiker - Discover the most interesting, weird and awesome websites of the Internet",
"description": "**Cloudhiker** is a collection of anything _interesting, weird or astonishing_; websites of exceptional quality, sites to kill time or learn something new. You won'\''t find any clickbait Buzzfeed stuff or low-effort blog articles here.",
"tags": [
148,
22
]
}'Could you please capture your jQuery api call and export an HAR? Maybe some data gets messed up in the request. |
All reactions
|
Thank you for thinking with me. I can also do Linkupdate-Api-Calls in PHP with no errors, therefore I also think there is something wrong with my implementation. |
All reactions
|
I don't see any obvious error in there either. 🤔 |
All reactions
|
I am getting so weird results with all of this, I think I remember testing your curl command a few days ago and it went through, but now it doesn't anymore? My PHP Code that I used for a few months for patching links (adding text to the description of links) still works, but now everytime produces the same error I posted above, but the description still gets changed. But when I try to add a tag using the same code snippets, it just produces the error, but does not change the tags. Could you confirm for me your curl commands still goes through without errors? and could you maybe try extending the taglist in the command, e.g. like thank you so much! |
All reactions
|
So for me no matter if I try the curl-request, and also when I call the API in PHP or Ajax, to PATCH/Update a link always produces the abovementioned error 500 on the server, both mine and the demo server. I need this because I am trying to create a few batch editing tools, e.g. "add tag x to all links with tag y", or "add text "lorem ipsum" to the description of all links with tag y", to better be able to handle my very large link collection. |
All reactions
|
I can see the error for the demo instance in Sentry. For whatever reason, the user ID is Sending that with a proper token leads to no error in the demo. |
All reactions
|
Ha, that sent me on the right path! It had to be the API token, as I just copied your command without any other changes. And the user ID is 0 because I always used "System API tokens" from the Dropdown-Menu to create one, not a user specific token ("API tokens" in the menu). I created a user API token, and my commands all work fine now. |
All reactions
|
Interesting. Indeed a bug, as this is caused by loading settings for the system user, which does not have settings associated. Created an issue for that. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Describe your issue
Hi everybody,
I am still stumbling with the API. Now I am trying to update a link with an AJAX call. I have the following script to try everything on the demo server. It is just supposed to get the link details (works), add a tag to those details, and update the link.
All reactions