spinen / connectwise-php-client Goto Github PK
View Code? Open in Web Editor NEWSPINEN's PHP client for the ConnectWise API
Home Page: http://spinen.com
SPINEN's PHP client for the ConnectWise API
Home Page: http://spinen.com
Client::buildOptions() was changed in 5.6.0,
Old
public function buildOptions(array $options = [])
{
return array_merge_recursive(
$options,
[
'headers' => $this->getHeaders(),
]
);
}
New
public function buildOptions(array $options = [])
{
return [
'body' => json_encode($options ?? []),
'headers' => $this->getHeaders(),
];
}
$options
is an array by default and is passed as body
on every request, meaning a GET request now has a body of []
. The result is a 403 error from cloudflare.
We should cast the response to an object that is a collection that allows better interaction with the data.
This is the continuation of a closed issue with the same title. My apologies but I got sidetracked onto another project. I have circled back to getting this configured on my WAMP test box and I continue to get the errors at:
var_export($info->toArray(), false);
Parse error: syntax error, unexpected 'var_export' (T_STRING) in php shell code on line 15
php > array (
php ( 'version' => 'v2016.6.43325',
php ( 'isCloud' => false,
php ( 'serverTimeZone' => 'Eastern Standard Time',
php ( )
The subsequent var_export commands return the same errors.
Any additional guidance is appreciated.
Thanks in advance.
connectwise-php-client/src/Api/Client.php
Line 157 in be0b391
$this->page
is actually set to true
instead of an int. Technically, this would be OK, but the problem arises when my token immediately needs refreshing and then the same client instance is called with a post
method, at which point $this->page
is set to 0
. The result is getAll
only ever returns 1 page of data.
Paging and passing query options has numerous issues that I won't be able to go into right now, but I was able to make it work by changing the ternary expression to this:
if ($verb === 'getAll') {
$this->page = 1;
$verb = 'get';
}
If $verb
is anything but getAll
, it remains null, so the other comparisons still work, and the worst that happens is an unnecessary page=1
query parameter is passed.
If I have some time next month, I can put together an issue illustrating what I saw with the query/options passing as well as a pull request with a possible solution.
connectwise-php-client/src/Api/Client.php
Line 389 in 2f3e481
The method referenced in the line above results in the full request headers being dumped into the browser, which reveals the authentication token to the user. Wouldn't it be better to re-throw the exception instead so the app can handle it without leaking sensitive data? I can submit a pull request if needed.
wondering if there is an example of using this to post data to connectwise from laravel. unclear how to add the JSON Body.
May I ask where one can obtain the ConnectWise Swagger definitions?
Bring back the "->where()" & "->orderBy()" methods to the API to allow cleaner interaction with the client
Hello
Just wondering if you have it on the roadmap to update to the later versions of the CW definition, as I see it getting a bit behind.
Thanks for an excellent package.
Kelvin
There are times that we may not have a logged in user (i.e. scheduled jobs to get data), so please allow for a default member in the ConnectWise config.
I apologize in advance if this is not the correct place to post this. Can someone please advise what values should be used for the integrator and password when setting up outside of Laravel?
$client->setIntegrator('')->setPassword('')
We don't have any usage docs or example in the repo. Need to do that.
Was asked about it in the generator repo spinen/connectwise-php-generator#8 by @mm-blxsoft
Hi All,
I successfully installed the package and proceeded to the non-Laravel configuration step. As I am updating the objects in the interactive PHP shell, I get to:
var_export($info->toArray(), false); array ( 'version' => 'v2018.5.56760', 'isCloud' => false, 'serverTimeZone' => 'Eastern Standard Time', )
then receive the following error.
Parse error: syntax error, unexpected 'var_export' (T_STRING) in php shell code on line 6
I am dev'ing on a WAMP server with PHP version 7.1.9 and Apache 2.4.27
Any guidance is appreciated.
Thank You
When I run composer require spinen/connectwise-php-client
.....
Problem 1
- Installation request for spinen/connectwise-php-client ^5.5 -> satisfiable by spinen/connectwise-php-client[5.5.0, 5.5.1, 5.5.2, 5.5.3].
- Can only install one of: guzzlehttp/guzzle[7.2.0, 6.5.x-dev].
- Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.2.0].
- Can only install one of: guzzlehttp/guzzle[6.5.x-dev, 7.2.0].
- Conclusion: install guzzlehttp/guzzle 6.5.x-dev
- Installation request for guzzlehttp/guzzle (locked at 7.2.0, required as ^7.1) -> satisfiable by guzzlehttp/guzzle[7.2.0].
Installation failed, reverting ./composer.json to its original content.
composer.json
"require": {
"php": "^7.3",
"aws/aws-sdk-php": "^3.156",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.2.0",
"laravel/framework": "^8.0",
"laravel/jetstream": "^1.3",
"laravel/sanctum": "^2.6",
"laravel/tinker": "^2.0",
"livewire/livewire": "^2.0"
},
Laravel will not let me downgrade to guzzle 6.5.x-dev
Check it over to make sure that it is clear & accurate.
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.