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

Swift error “Cannot subscript a value of type [Uint8]”
Any good algorithm for this two-dimensional array quiz?
Created a new array from another array. Need to sort the new one in the order of elements of the other array
Fast Copy Array in Array VB6.0
Fortran array with explicit double precision
Marshaling slice results in character string
How can I use an array as the arguments to a builtin function (sprintf, join, etc.) in Perl?
Index was out of range using 2 picturebox lists
Bash: array made from inside a sourced function won't be exported
how to i fomat 4 digit in Arrays.sort(java)
$push in MongoDb not working?
ValueError: matplotlib display text must have all code points < 128 or use Unicode strings
How to retrieve all hash keys
In MATLAB, how do I scan my .txt files for numbers to put in an array?
Matlab converting cell array to numeric matrix for svmtrain
Two dimentional key value array in VB

Categories

HOME
converter
caching
symfony
google-cloud-bigtable
payment-gateway
nlp
winapi
firebase-app-indexing
histogrammar
pygame
google-spreadsheet-api
powershell-v3.0
x-frame-options
phoenix
ejs
spring-cloud-config
riak
netezza
rhapsody
cairo
ada
prestodb
clover
ip-camera
koa
sensu
npm-install
logarithm
philips-hue
switching
hanami
image-quality
pptp
ggmap
dpi
mangodb
bxslider
entity-system
picturebox
fabric-digits
npm-shrinkwrap
superpowered
remote-server
pox
pmwiki
agent
delphi-10.1-berlin
brute-force
tic-tac-toe
wsadmin
z3py
number-theory
web-deployment-project
mercury
barcode-printing
rsqlite
glkit
ruby-2.0
mongoskin
spring-repositories
scriptlet
multinomial
servlet-3.0
file-diffs
matcaffe
oai
windowlistener
team-build
graphical-logo
lines-of-code
pgm
uos
code-first-migrations
sqoop2
cloudpebble
snmp4j
genetic-programming
facebook-wall
system.web
emma
map-force
winrt-httpclient
circos
mimosa
baucis
pyjade
fogbugz-api
.net-cf-3.5
stagefright
windows-update
xslkey
couchdb-lucene
fotoware
flexicious
nsindexpath
rubycas
adsl
.app
grooveshark
webrat
openwysiwyg
act

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