allejo / phpsoda Goto Github PK
View Code? Open in Web Editor NEWA Socrata Open Data API (SODA) client library for PHP
Home Page: https://allejo.dev/PhpSoda/
License: MIT License
A Socrata Open Data API (SODA) client library for PHP
Home Page: https://allejo.dev/PhpSoda/
License: MIT License
See here: socrata/discuss#30
Things to do:
composer.json
Hi,
I want to use the PHP PhpSoda library in my own project how can i add SodaClient in my index.php file
When i add "use allejo\Socrata\SodaClient;" and i instantiate $sc = new SodaClient("http://opendata.socrata.com"); it's give me the error ( ! ) Fatal error: Class 'allejo\Socrata\SodaClient' not found in C:\wamp\www\Socrata\PhpSoda\tests\index.php on line 6
Call Stack
1 0.0010 131408 {main}( ) ..\index.php:0
how can i resolve it please?
In original documentation , Select query with aliases is given the following explanation:
https://github.com/allejo/PhpSoda/wiki/Working-with-SoQL-Queries
I came across two issues while working with aliases:
eg: $selectWithAliases = array(
"origin" => "origin_type"
);
URL formed: https://.../.../...?$select=origin AS origin
Expected URL: https://.../.../...?$select=origin%20AS%20origin
eg: $selectWithAliases = array(
"origin",
"file_type",
"year" => "publication_year"
);
URL formed: https://.../.../...?$select=origin AS ,file_type AS ,year AS publication_year
Expected URL: https://.../.../...?$select=origin,filer_name,year AS publication_year
A patch is required in line 169 of src/SoqlQuery.php to fix these 2 issues:
$formattedValues[] = (is_string($key) && (!is_null($value))) ? rawurlencode(sprintf($format, trim($key), trim($value))) : (is_string($key) ? $key : $value);
(is_string($key) && (!is_null($value))) ? rawurlencode(sprintf($format, trim($key), trim($value))) : (is_string($key) ? $key : $value) will handle the following cases:
Write operations to Socrata datasets with the Socrata Open Data API differ from write operations with the more recent Data Management API. Specifying which API this library uses helps prevent user confusion.
Adding something like:
Note: This library supports writing directly to datasets with the Socrata Open Data API. For datasets with one or more data transformations applied to the schema through the Socrata Data Management Experience (the user interface for creating datasets), use the Socrata Data Management API to apply those same transformations to all updates. For more details on when to use SODA vs the Socrata Data Management API, see the Data Management API documentation
to the readme and wiki would help clarify expectations when publishing to Socrata.
I'll open a PR with changes.
PhpSoda/src/Exceptions/HttpException.php
Line 33 in 74f6ae9
Should the check have a ! in it?
The following gets passed into $response which does not json_decode and falls into the if block.
HTTP/1.1 100 Continue
HTTP/1.1 400 Bad Request
Server: nginx
Date: Mon, 24 Jun 2019 20:00:04 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Socrata-RequestId: 316xuzmsevgwlsbdhjwwokmpw
Access-Control-Allow-Origin: *
X-Error-Code: invalid_request
X-Error-Message: Illegal field name sent: contractor_nid
Cache-Control: private, no-cache, must-revalidate
Age: 0
X-Socrata-Region: aws-us-east-1-fedramp-prod
{
"code" : "invalid_request",
"error" : true,
"message" : "Illegal field name sent: contractor_nid"
}
Reflect these changes: https://dev.socrata.com/changelog/2015/11/25/soda-api-versioning.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.