api and px web

158 views
Skip to first unread message

borodu...@gmail.com

unread,
Mar 7, 2022, 12:15:23 PM3/7/22
to pcaxis
Dear all

i have a file based px web instalation 
-- http://pxweb.monstat.org/pxweb   - version for serbian language
http://pxweb.monstat.org/PXWebEng   - version for english language


Our goverment open data portal https://data.gov.me/ is trying to colect data from my PX web database via API.

I have approved API via px web administration

Untitled.pngUntitled2.png

When I tupe pxweb.monstat.org/PXWeb/api/v1/sr I get list of databases but no data

Can I work with API and file base px web?

Do I need to change something in my px files?

Any help is welcomed and appriciated

Regards

Boro

Jan Bruusgaard

unread,
Mar 8, 2022, 4:13:44 PM3/8/22
to pcaxis
Yes, you traverse the structure down to the table metadata.

Http GET only gives the metadata for the table as JSON.

To get the data you use http POST.

You post your api query as JSON towards the URL. 

I can come back with an example, if needed. 

Kind regards,
Jan Bruusgaard
Statistics Norway

borodu...@gmail.com

unread,
Mar 9, 2022, 7:45:46 AM3/9/22
to pcaxis
Hi Jan, 

thanks for explanation.

And yes an example would be very helpufull and appiciated

Tnanks

Boro

Jan Bruusgaard

unread,
Mar 14, 2022, 7:38:56 AM3/14/22
to pcaxis

Hello Boro,

To test if your API works, you can post a query like [ ]. That gives all values for variables where elimation is false and the eleminated value (Total)  when elimination is set to true.

{
  "query": [
  ],
  "response": {
    "format": "xlsx"
  }
}

See enclosed response in Excel. I also got response by changing format "xlsx" to px, json-stat2 or xlsx.

A good way to test the API is using Postman https://www.postman.com/downloads/

postman.png

You can also find also some general hints in our API-user guide in English. 

Kind regards
Jan 
response.xlsx

borodu...@gmail.com

unread,
Mar 15, 2022, 5:36:36 AM3/15/22
to pcaxis
Hello Jan
Yes!!!

Thank very much
Boro
Reply all
Reply to author
Forward
0 new messages