Google Reseller API returning "Resource already exists" on Insert Customer - google-provisioning-api

Dear Google Engineers,
I keep trying to insert a customer and receive the following response:
[error] => Array
(
[errors] => Array
(
[0] => Array
(
[domain] => global
[reason] => duplicate
[message] => Resource already exists
)
)
[code] => 409
[message] => Resource already exists
)
I then go about attempting to retrieve the customer resource that supposedly exists via a GET request to https://www.googleapis.com/apps/reseller/v1/customers/{customerId} which fails to find the resource:
[error] => Array
(
[errors] => Array
(
[0] => Array
(
[domain] => global
[reason] => notFound
[message] => Not Found
)
)
[code] => 404
[message] => Not Found
)
Either I've uncovered a bug or the error response from POST https://www.googleapis.com/apps/reseller/v1/customers/ isn't nearly detailed enough for me to diagnose.
I've tried variations of the required fields with random values (addressLine1, alternateEmail, phoneNumber). I've also logged in to the Reseller CPanel and no matching customer exists for the domain.
If Google engineers care to try and diagnose internally, the customerId in question is ruby-stagingpop.co. You can email me to find out my Reseller account if necessary. Info in my profile.

Related

Connecting to Twilio SMS via a Proxy in PHP

I'm testing Twilio to use as our SMS solution however I'm having issues getting it to work behind our proxy server.
I've tried:
$twiliohttp = new Services_Twilio_TinyHttp(
"https://api.twilio.com",
array("curlopts" => array(
CURLOPT_USERAGENT => self::USER_AGENT,
CURLOPT_HTTPHEADER => array('Accept-Charset: utf-8'),
CURLOPT_CAINFO => dirname(__FILE__) . '/cacert.pem',
CURLOPT_PROXY => '3.X.X.X:9400',
))
);
$client = new Services_Twilio($account_sid, $auth_token, null, $twiliohttp );
$message = $client->account->messages->sendMessage(
'+441432XXXX31', // From a Twilio number in your account
'+44776XXXX712', // Text any number
"Hello monkey!"
);
I then get the error: Fatal error: Cannot access self:: when no class scope is active in /var/www/twiliosms.php on line 16
So I modified the Twilio.php file modifying the curlopts array to add:
CURLOPT_PROXY => '3.X.X.X:9400',
and calling Twilio with:
$client = new Services_Twilio($account_sid, $auth_token );
$message = $client->account->messages->sendMessage(
'+4414XXXXXXX1', // From a Twilio number in your account
'+4477XXXXXXX2', // Text any number
"Hello monkey!"
);
But I then get the error:
Fatal error: Uncaught exception 'Services_Twilio_RestException' with message 'Could not decode response body as JSON. This likely indicates a 500 server error' in /var/www/GE/includes/SMS/Twilio.php:288
Stack trace:
#0 /var/www/GE/includes/SMS/Twilio.php(181): Base_Services_Twilio->_processResponse(Array)
#1 /var/www/GE/includes/SMS/Twilio/ListResource.php(92): Base_Services_Twilio->createData('/2010-04-01/Acc...', Array)
#2 /var/www/GE/includes/SMS/Twilio/Rest/Messages.php(24): Services_Twilio_ListResource->_create(Array)
#3 /var/www/GE/includes/SMS/Twilio/Rest/Messages.php(71): Services_Twilio_Rest_Messages->create(Array)
#4 /var/www/GE/twiliosms.php(35): Services_Twilio_Rest_Messages->sendMessage('+441432233131', '+447766205712', 'Hello monkey!')
#5 {main}
thrown in /var/www/GE/includes/SMS/Twilio.php on line 288
Any ideas how to make this solution work through a proxy server that doesn't allow inbound connections?
Thanks in advance.
Ricky from Twilio here.
Although I couldn't test with your exact proxy setup I think the first solution you tried will work if you hardcode the user agent. For example:
$twiliohttp = new Services_Twilio_TinyHttp(
"https://api.twilio.com",
array("curlopts" => array(
CURLOPT_USERAGENT => "Twilio Proxy/1.0",
CURLOPT_HTTPHEADER => array('Accept-Charset: utf-8'),
CURLOPT_CAINFO => dirname(__FILE__) . '/cacert.pem',
CURLOPT_PROXY => '3.X.X.X:9400',
))
);
You also may need to make the modification to the TinyHttp library shown here.
Many thanks to RickyRobinett this is how to resolve the issue, I post this answer with the full solution so people don't have to trove through the badly formatted comments.
Update TinyHttp in line with: https://github.com/camuthig/twilio-php/commit/20d4f3c4479c93894866f498e89a0f13cf16d6bf
$twiliohttp = new Services_Twilio_TinyHttp(
"https://api.twilio.com",
array("curlopts" => array(
CURLOPT_USERAGENT => "Twilio Proxy/1.0",
CURLOPT_HTTPHEADER => array('Accept-Charset: utf-8'),
CURLOPT_CAINFO => 'includes/SMS/cacert.pem',
CURLOPT_PROXY => 'X.X.X.X:9400',
))
);
$client = new Services_Twilio($account_sid, $auth_token, null, $twiliohttp );
If you don't have the cacert.pem then checkout this post https://stackoverflow.com/a/31297747/1697288

Neo4j exception when inserting data

I'm trying to insert bulk data into Neo4j using a script. After a while the script breaks with the following Exception.
PHP Fatal error: Uncaught exception 'Everyman\Neo4j\Exception' with message 'Unable to execute query [400]:
Headers: Array
(
[Content-Length] => 3031
[Content-Type] => application/json; charset=UTF-8
[Access-Control-Allow-Origin] => *
[Server] => Jetty(6.1.25)
)
Body: Array
(
[message] => An identifier is used with different types. The identifier ` UNNAMED2` is used both as Relationship and as Collection
[exception] => CypherTypeException
[fullname] => org.neo4j.cypher.CypherTypeException
[stacktrace] => Array
(
[0] => org.neo4j.cypher.internal.symbols.SymbolTable.add(SymbolTable.scala:33)
[1] => org.neo4j.cypher.internal.symbols.SymbolTable$$anonfun$checkNoOverlapsExist$1.apply(SymbolTable.scala:47)
[2] => org.neo4j.cypher.internal.symbols.SymbolTable$$anonfun$checkNoOverlapsExist$1.apply(SymbolTable.scala:46)
[3] => scala.collection.immutable.Map$Map1.foreach(Map.scala:109)
[4] => org.neo4j.cypher.internal.symbols.Symbol in phar:///var/www/zomato9/application/library/neo4jphp.phar/lib/Everyman/Neo4j/Command.php on line 116
The same query works from console and restarting the script from the same point where exception occurred works again for a while until it fails again. Catching the Exception and making the script sleep for few seconds does not break the script.
Any suggestions on what might be happening here?
UPDATE: Added a sample query
START a = node:?("?:?"), b = node:?("?:?")
MATCH a-[c1:ACTIVITY_LIST*]->z, z-[r1:ACTIVITY_LIST]->y
WHERE z.TIMESTAMP >= '.$time.' AND y.TIMESTAMP < '.$time.'
CREATE n = {?}, clist = {COMMENT_ID: ''}, a-[:IN_?]->n, n-[:OUT_?]->b, n-[:COMMENT_LIST]->clist, z-[:ACTIVITY_LIST]->n, n-[:ACTIVITY_LIST]->y
DELETE r1
RETURN n;

Youtube video processing status stuck on "processing" after an upload with the google api php client

I have a problem uploading a video on my youtube account using the google api php client 0.6.4
The upload seems ok but the video status is stuck on "processing"
Array
(
[status] => Array
(
[uploadStatus] => uploaded
[privacyStatus] => public
[license] => youtube
[embeddable] => 1
[publicStatsViewable] => 1
)
[processingDetails] => Array
(
[processingStatus] => processing
[fileDetailsAvailability] => inProgress
[processingIssuesAvailability] => inProgress
[tagSuggestionsAvailability] => inProgress
[editorSuggestionsAvailability] => inProgress
[thumbnailsAvailability] => inProgress
)
)
Has someone an advice on this ?
Thanks !
** UPDATE **
The processingDetails has change lately, but the status is still stuck on "processing"
Array
(
[status] => Array
(
[uploadStatus] => uploaded
[privacyStatus] => public
[license] => youtube
[embeddable] => 1
[publicStatsViewable] => 1
)
[fileDetails] => Array
(
[fileType] => video
[container] => mov
)
[processingDetails] => Array
(
[processingStatus] => processing
[fileDetailsAvailability] => available
[processingIssuesAvailability] => available
[tagSuggestionsAvailability] => inProgress
[editorSuggestionsAvailability] => inProgress
[thumbnailsAvailability] => inProgress
)
[suggestions] => Array
(
[processingHints] => Array
(
[0] => nonStreamableMov
)
)
)
If the API upload succeeded then things sound like they're working as intended from the API perspective. What I'd recommend doing is trying to upload the same raw video file via the browser at http://www.youtube.com/upload and see if that video is successfully processed or also gets stuck.
If it also gets stuck, then the problem is your video.
If it gets processed, then there might have been some one-off problem that affected your upload via the API, and I'd suggest retrying. If the problem is consistent with API uploads (and try with different files, too) then it sounds like a bug with the client library.

Could not authenticate with OAuth error when passing parameters Twitter API

I am getting "Could not authenticate with OAuth" error when i pass parameters to the Twitter API. if i don't pass any parameter then it works fine.
Can anybody look into this issue and provide me the solution.
My OAuth request array is as below
Array
(
[method] => GET
[uri] => Array
(
[host] => api.twitter.com
[path] => 1/direct_messages.json
)
[auth] => Array
(
[method] => OAuth
[oauth_token] => 605267577-YwEtkLXgDZcXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[oauth_token_secret] => p2SKUjaRz7oUqW8jmXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[oauth_consumer_key] => PAu4LlcETXXXXXXXXXXXXX
[oauth_consumer_secret] => OA2ISmIYMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
)
[body] => Array
(
[count] => 200
)
[header] => Array
(
[Authorization] => OAuth oauth_version="1.0",oauth_signature_method="HMAC-SHA1",oauth_token="605267577-YwEtkLXgDZcLaFIZHdJxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",oauth_consumer_key="PAu4LlcETSxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",oauth_nonce="616caa42455f6a490f7fce089fdb56b5",oauth_timestamp="1342592116",oauth_signature="B2Dr4CioXL55fwxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)
)
i passed the "count" parameter and this is response that i got
Array
(
[error] => Could not authenticate with OAuth.
[request] => /1/direct_messages.json
)
Thanks in advance,
Intekhab
You do not authenticate correctly. You have to follow this process : https://dev.twitter.com/docs/auth/authorizing-request
I had the same problem until I found out that API needs to have that parameter in oauth array and in URL query.

FedEx 556 - No valid services available. when there should be

Hi I'm trying to use the wsdl api to get shipping cost calculated for my website.
I'm using opencart and this module (http://www.opencart.com/index.php?route=extension/extension/info&extension_id=2055&filter_search=fedex&sort=e.date_modified&order=DESC).
On checkout I'm getting this error:
WARNING::556::There are no valid services available.
But I tried the same from and to address on the calculator on the fedex website and it gives me two services: International Priority and International Economy
This is the debug data I have:
Array
(
[WebAuthenticationDetail] => Array
(
[UserCredential] => Array
(
[Key] => REDACTED
[Password] => REDACTED
)
)
[ClientDetail] => Array
(
[AccountNumber] => REDACTED
[MeterNumber] => REDACTED
)
[TransactionDetail] => Array
(
[CustomerTransactionId] => *** Rate Request v9 using PHP ***
)
[Version] => Array
(
[ServiceId] => crs
[Major] => 9
[Intermediate] => 0
[Minor] => 0
)
[ReturnTransitAndCommit] => 1
[RequestedShipment] => Array
(
[DropoffType] => REQUEST_COURIER
[ShipTimestamp] => 2011-09-28T09:02:01+00:00
[PackagingType] => YOUR_PACKAGING
[TotalInsuredValue] => Array
(
[Amount] => 2000
[Currency] => EUR
)
[Shipper] => Array
(
[Address] => Array
(
[StreetLines] => Array
(
[0] =>
[1] =>
)
[City] => Ronchis
[StateOrProvinceCode] =>
[PostalCode] => 33050
[CountryCode] => IT
[Residential] => 1
)
)
[Recipient] => Array
(
[Address] => Array
(
[StreetLines] => Array
(
[0] =>
[1] =>
)
[City] => villach
[StateOrProvinceCode] =>
[PostalCode] => 9500
[CountryCode] => AT
[Residential] => 1
)
)
[ShippingChargesPayment] => Array
(
[PaymentType] => SENDER
[Payor] => Array
(
[AccountNumber] => 263150082
[CountryCode] => IT
)
)
[RateRequestTypes] => LIST
[PackageCount] => 1
[PackageDetailSpecified] => 1
[PackageDetail] => INDIVIDUAL_PACKAGES
[RequestedPackageLineItems] => Array
(
[0] => Array
(
[Weight] => Array
(
[Value] => 34
[Units] => KG
)
[Dimensions] => Array
(
[Length] => 48
[Width] => 53
[Height] => 122
[Units] => CM
)
)
)
)
)
----------
-- NUSOAP -- Array
(
[HighestSeverity] => WARNING
[Notifications] => Array
(
[Severity] => WARNING
[Source] => crs
[Code] => 556
[Message] => There are no valid services available.
[LocalizedMessage] => There are no valid services available.
)
[TransactionDetail] => Array
(
[CustomerTransactionId] => *** Rate Request v9 using PHP ***
)
[Version] => Array
(
[ServiceId] => crs
[Major] => 9
[Intermediate] => 0
[Minor] => 0
)
)
What should I do?
I just ran into this error, and it turned out that the issue was an invalid postal code. Double check that you are specifying the "Shipper" information correctly.
Also, if that doesn't work give the FedEx customer support phone number a try. We would not have figured this issue out without their help.
I was also having this issue .. but with Joomla, Virtuemart. Because the FedEx server is the same so may be my solution could help somebody else too..
Here are the main things what I fixed to fix this issue.
Product's Weight should be less than the limit if you've set any as Maximum Weight.
If you are using any packaging has more weight than FedEx's provided box i.e. 25KG BOX or 10KG box, then always use "Your Own packaging"
it's true, do keep an eye on ZIP===States (i was testing and put wrong state with different zip) And this ZIP should be added in "Shop's Address" because this is considered as FROM and the destination address as well.
Do note if products have added weights. LWH (Length, Width, Height).
Mine issue resolved after weeks of trouble! I wish somebody else could also resolve this issue if facing.
I was facing following error
"10 kg packaging box is **only** Available at FedEx World Service CenterĀ® locations!"
which was a big help to resolve the limitation i've set.
This issue happen when one of the bellow cases.
Country given is not associated with FedEx account.
Origin address is not real, Especially the post code.
The given packagingType is available in your country.
You need to provide a ServiceType. One of these:
EUROPE_FIRST_INTERNATIONAL_PRIORITY
FEDEX_1_DAY_FREIGHT
FEDEX_2_DAY
FEDEX_2_DAY_AM
FEDEX_2_DAY_FREIGHT
FEDEX_3_DAY_FREIGHT
FEDEX_EXPRESS_SAVER
FEDEX_FIRST_FREIGHT
FEDEX_FREIGHT_ECONOMY
FEDEX_FREIGHT_PRIORITY
FEDEX_GROUND
FIRST_OVERNIGHT
GROUND_HOME_DELIVERY
INTERNATIONAL_ECONOMY
INTERNATIONAL_ECONOMY_FREIGHT
INTERNATIONAL_FIRST
INTERNATIONAL_PRIORITY
INTERNATIONAL_PRIORITY_FREIGHT
PRIORITY_OVERNIGHT
SMART_POST
STANDARD_OVERNIGHT
Use it in the same level as the DropoffType
Make sure that you have the Zip Code set to required.
You can do that in System -> Localization -> Countries.
It is not required by default in opencart, and the fedex shipping system will not work without it.
This issue can also be caused by requesting insurance in a country that doesn't support it, such as Canada.
I also ran into this problem and the solution was trimming extra spaces from the end of the address, city & postal code. After that, all was well again.
I don't know why FedEx's API all of a sudden stopped accepting the extra spaces, but who knows...
In my case, this was caused by trying to ship internationally from the US to Italy, and having specified a SignatureOptionDetail of NO_SIGNATURE_REQUIRED. Changing this to SERVICE_DEFAULT fixed it.

Resources