Mediawiki API error: "Unrecognized value for parameter 'prop': extracts" - mediawiki

I`am using the Mediawiki API offline on my server.
I installed everything and it works but if i try a query it returns the error: "Unrecognized value for parameter 'prop': extracts" than i installed the TextExtracts extension and also the MobileFrontend extension, but it's still not working.
I tried this from the answer in this question.
My url:
api.php?action=parse&page=Paul_McCartney&prop=extracts&format=xml
error:
http://prntscr.com/9y6df7
Mediawiki versions:
http://prntscr.com/9y6d01

The TextExtracts extension implements a query Api module, so you can't use the extracts prop with the parse action. Instead of your url, you can use:
api.php?action=query&page=Paul_McCartney&prop=extracts&format=xml
(see the action parameter, which changed from parse to query)
to get the extracts prop.

Related

UrlFetchApp function not working with arrays

I'm using this IMPORTJSON script I found on Github to retrieve data from the Facebook Graph API.
It was working fine until I started using filtering arrays in the URL.
For example, this URL works fine :
https://graph.facebook.com/v10.0/account_id/insights?&level=campaign&fields=campaign_name,campaign_id,actions&access_token=access_token&date_preset=last_week_mon_sun
but when I try to retrieve data from the URL below, I get the following error = "Exception: Invalid argument" :
https://graph.facebook.com/v10.0/account_id/insights?&level=campaign&fields=campaign_name,campaign_id,actions&filtering=[{field:"campaign.id",operator:"IN",value:[12345678910]}]&access_token=access_token&date_preset=last_week_mon_sun
After troubleshooting, I think that the problem comes from the UrlFetchApp used in the script.
Is there anyway to format the URL to avoid getting an error ?
Solution found : I used the encodeURIcomponent function to encode (You have to use it on the parameters only, not on the whole URL !)
Eg : encodeURIComponent([{field:"campaign.id",operator:"IN",value:[12345678910]}])

VM892:1 Uncaught SyntaxError: Unexpected token e in JSON at position 0

I'm presently working on a phx / phoenix API written in Elixir. And I have created a frontend for the API using React.js. However, I'm getting the below error message in the JS console of the browser.
I have successfully created a user using Postman, so I'm 99% sure the error isn't with the phx project, but rather somewhere with the React project.
I have both the frontend and backend hosted on github. And a .env file will need to be created in the root of the React project with the below line,
REACT_APP_API_URL=http://localhost:4000/api
and was working my way through the following tutorial.
Any and all help would greatly be appreciated.
The output of localStorage.getItem("token") being
eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJVc2VyOjEiLC‌​JleHAiOjE0ODcyODI4OD‌​csImlhdCI6MTQ4NDY5MD‌​g4NywiaXNzIjoiUGhvZW‌​5peENoYXQiLCJqdGkiOi‌​IwNzFlYzgwYi0wZmYzLT‌​QyYzgtODA3Mi1kNzViZm‌​VhZTg4NWEiLCJwZW0iOn‌​t9LCJzdWIiOiJVc2VyOj‌​EiLCJ0eXAiOiJhY2Nlc3‌​MifQ.NsuqH50HooK8vjF‌​fHtPH9iXSykZ9oYA0ul4‌​b_C5fQtpu_zFvNNy-skc‌​v9HI2i25X-NlB-9xOr-x‌​zh2abnrpYUw
suggests that for some reason, the app stored the token without passing it through JSON.stringify, and calling JSON.parse on this string throws the Unexpected token e error, as expected.
I did not see any localStorage.setItem without JSON.stringify in the current code, so the token was probably stored like that in a previous version of the app. You should try clearing it manually and logging in again.
When we get the non-JSON response, we get such error..
To avoid such error, mention the responseType: Text in your api endpoint call.
This will work,
return this.http.post(`${environment.apiUrl}/login`, user, {responseType: 'text'});
This will not work(If you mention type),
return this.http.post<string>(`${environment.apiUrl}/login`, user, {responseType: 'text'});
This error message usually means you're getting a non-JSON response. If you look at the raw response in the Network tab of your debugger, you should be able to see what you're getting back from the server.

Serviio throwing 553 on resource

I have the following setup:
1 serviio service running v1.2 on a server and when i fetch my streaming urls via an API, they work like they should
but now I want to upgrade it to v1.5.1, so I installed it on my dev computer, and when i fetch the list it gives me them
but then when I want to stream I get errorCode 553 (missing or invalid token)
but when I use the same token that I used to get all the videos, it has no problem.
I'm using the same code for fetching on v1.2 and then the tokens were valid.
any clue why this is happening?
this is the url I was using that throws the 553:
http://localhost:23424/cds/resource/4/MEDIA_ITEM/AVC_MP4_MP_HD_720p_AAC-0/ORIGINAL?profile=html5?authToken=5e213da362d64b1c908d6be06b84720d
this is the url I was using that works just fine:
http://localhost:23424/cds/browse/html5/V_F%5EFOL_R1/BrowseDirectChildren/items/0/99999999?authToken=5e213da362d64b1c908d6be06b84720d
The first link should be:
http://localhost:23424/cds/resource/4/MEDIA_ITEM/AVC_MP4_MP_HD_720p_AAC-0/ORIGINAL?profile=html5&authToken=5e213da362d64b1c908d6be06b84720d
Note the ? is converted to & to add the authToken back to query string.

Mediawiki API error: Unrecognized value for parameter 'prop': extracts

I have a new installation of mediawiki. I am trying to use the API to simply get an article. The API url I am using is:
https://example.com/mediawiki/api.php?action=query&format=json&prop=extracts&titles=Vendor_cisco
Upon going to that URL I get: Unrecognized value for parameter 'prop': extracts
This seems odd because all of the following urls do work and return the right data:
https://example.com/mediawiki/api.php?action=query&format=json&prop=links&titles=Vendor_cisco
https://example.com/mediawiki/api.php?action=query&format=json&prop=categories&titles=Vendor_cisco
https://example.com/mediawiki/api.php?action=query&format=json&prop=revisions&titles=Vendor_cisco
How do I get the body and text from my article? I was under the impression prop=extracts is what is used.
prop=extracts is part of TextExtracts extension (formerly MobileFrontend extension). If you don't have that extension installed, you won't be able to use prop=extracts.

GeoServer not returning correct JSON for WFS using OpenLayers.Protocol.Script

I am trying to get json features from GeoServer 2.3.0. I have duplicated the code from an example and it works as expected. However, when I set the url to my GeoServer and desired layer, the returned format isn't the same and results in this error: "Uncaught SyntaxError: Unexpected token : "
The example server returns the json features in this format:
OpenLayers.Protocol.Script.registry.c1({"type":"FeatureCollection","features":[{"type":"Feature","id":"cities.2","geometry": ...
My GeoServer returns the json features in this format:
{"type":"FeatureCollection","features":[{"type":"Feature","id":"poi.1","geometry": ...
The error is caused by my GeoServer not returning the json wrapped in the callback function. This seems to be a server config issue but as a GeoServer noob, I have been unable to find the correct settings to tweak.
Discovered the solution. The server has JSONP disabled by default. Setting the environment variable ENABLE_JSONP=true and requesting the format "text/javascript" yields the expected results. Still not sure why the example server returns the correct jsonp with the requested format of "json".