arrays


Api post request. What is wrong with my script?


I am trying to create a post request for an energy company but I keep getting a failed message. Can you guys help me out and let me know if this looks off? Thanks
$fields = array("firstName"=>"Test",
"lastName"=>"Tester",
"dob"=>"01/01/1980",
"socialSecurity"=>"123456789",
"phoneAreaCode"=>"111",
"phoneExchange"=>"111",
"phoneLine"=>"1111",
"email"=>"test#test.com",
"serviceAddress"=>array(
"line1"=>"123 Main ST",
"line2"=>"Unit 123",
"city"=>"Decatur",
"state"=>"GA",
"zip"=>"30031"
),
"mailingAddress"=>array(
"line1"=>"7001 SW 24th AVE",
"city"=>"Gainesville",
"state"=>"FL",
"zip"=>"32607"
),
"utilityName"=>"AGLC",
"ratePlanName"=>"6 mo Fixed",
"requestedService"=>"SWITCH",
"language"=>"ENGLISH",
"referredBy"=>"Test Referral",
"marketerName"=>"Test Marketer");
$str_data = json_encode($fields);
$uri = "https://sandbox.infiniteenergy.com/api/enrollments";
$response = \Httpful\Request::post($uri)
->addHeaders(array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'AccessKeyId' => 'a13bd2fa-f959-4f91-b238-9757a3172945'
))
->body($str_data)
->sendsJson()
->send();
I keep getting {"success":false,"message":"Method not allowed","data":null}
I am about to pull my hair out I need this fixed today.
Method Not allowed is triggered when your API could be hit with post and you are hit it with get request, vice versa
so if your method is HttpGet you have to make an htttp get request and if it is post you have to make and httpPost request

Related Links

How to retrieve the contents of a particular Array, the name of which is in a variable, in Swift 2
Table sort and lookup
Find first occurence of specified element in an array
Excel VBA - Assign Values of 2D Array to Range of Cells
error filling array with class instances in swift
Removing an Object from an Array in Mongoose/MongoDB
Parse.com: query on an array field not working with a big number of values
Trouble Printing a Dynamic Array of Sheets with VBA
Ruby gives different results for different approaches to array of arrays
Creating a GUI that outputs month and days using array
Complex JSON and looping over to update data
Add elements to an array using instance methods
what is the best algorithm to search an array for a bit pattern using bitwise AND?
How to use defN in Math.FFT in Haskell? How to construct a multi-dimensional CArray?
Sum subsets of vector by indices stored as vectors in cell array
MongoDB query for field in embedded document in array

Categories

HOME
jar
angular2-routing
json-ld
visualization
transparent
matplotlib
automated-tests
apache2
rebol
data-science-experience
ng-admin
contact-form-7
powershell-v3.0
ssr
cs-cart
x-frame-options
spring-cloud-config
r-lavaan
apache-karaf
off-canvas-menu
primes
device-detection
kadanes-algorithm
pycrypto
apply
jquery-form-validator
tarantool
guile
version-numbering
vcard
system.data.sqlite
mayavi
crt
entity-system
pyscripter
ios-ui-automation
gettext
.net-assembly
declare
ntfs-mft
polyfills
lexical-analysis
wcf-security
web-development-server
rkt
stress-testing
fastq
facebook-chatbot
encapsulation
goquery
multi-agent
azureportal
chrome-remote-desktop
instruction-set
communication-protocol
shinyjs
efxclipse
windows-azure-pack
update-site
tuxedo
linkageerror
listadapter
squirrel
approval-tests
android-recyclerview
schtasks.exe
rad
mptcp
connection-reset
leadtools-sdk
bridge
swift2.1
scrollspy
utf-32
temp-tables
grunt-contrib-concat
node-inspector
ember-components
sthttprequest
httpcontext
bounds
mimosa
fogbugz-api
driver-signing
va-list
justgage
apache2.2
google-closure-library
xslkey
pascals-triangle
javascriptserializer
symfony-2.0
macruby
concurrent-programming
wchar
objectbrowser
shared-objects
ou
posting
phpcrawl
.app
requestfactory
yajl
communicationexception
multibyte-functions
opcodes
method-signature

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App