Trying to access admin api through POST request

New Member
2 0 0

I have created a private app in the shopify to access admin api links to create new customer or register a customer.

 

I want to POST request to the link as 

 

https://<api key>:<passowrd>@teststorewbc.myshopify.com/admin/api/2019-07/customers.json

 

With ajax code:

 

var request =  {

"customer": {

"first_name": "Steve",
"last_name": "Lastnameson",
"email": "steve.lastnameson1@example.com",
"phone": "+15142546011",
"verified_email": true,

}

};

 

$.post(

"https://<api key>:<passowrd>@teststorewbc.myshopify.com/admin/api/2019-07/customers.json",
JSON.stringify( request),

function(data){

console.log(data);

}

);

 

But this code is not working.

 

I tried in postman app it worked fine with the requests. 

 

I need to work with the AJAX only

 

Please assist what is issue with code that it is not working or please provide the correct ajax code that would work.

0 Likes
Highlighted
Shopify Expert
2000 82 1452

It's a good thing the code is not working as you will be exposing your private API key details to anyone that cares to watch the network logs, or just look at the page source. If that key has write access to customers it would mean that I could use it to see ALL of your customers info, change aspects of their account, or even just delete them. Are you comfortable with being responsible for that kind of data leak?

 

Please don't access the Admin API in this way.

 

Let's step back and understand why you're doing this in the first place. Shopify already has a customer registration process. Why are you trying to do it via the API?

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
New Member
2 0 0

 


@Jason wrote:

It's a good thing the code is not working as you will be exposing your private API key details to anyone that cares to watch the network logs, or just look at the page source. If that key has write access to customers it would mean that I could use it to see ALL of your customers info, change aspects of their account, or even just delete them. Are you comfortable with being responsible for that kind of data leak?

 

Please don't access the Admin API in this way.

 

Let's step back and understand why you're doing this in the first place. Shopify already has a customer registration process. Why are you trying to do it via the API?


If there is no option then I guess I have to go with it..

 

I cant find any register customer api..

Could you please provide the link for that so I may use it for purpose of registering users as customers from frontend?

0 Likes