Forum

Thread tagged as: Question, Api

Import Asset in Regular Perch

Is the Asset Importer api available for regular Perch, not Perch Runway?

Yan Ping Tay

Yan Ping Tay 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It doesn't make much sense to use in Perch, but yes, it's there.

When users register as members, a unique membership card is created and stored against each member. Admin can access it as well, and change it if necessary.

Do you think Asset Importer is the right way to store the membership card? I'm not sure what else to use. If there's a better way please advise, I'll gladly learn.

I'm also not sure how to call the API. From https://docs.grabaperch.com/api/import/assets/, I'm not sure where to create an instance of the API. Tried it in a test page, but the page simply doesn't load. Nothing in the error log either.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Yan,

What is a membership card in your case? Is it a file (e.g. image or PDF) you wish to import?

Hi Hussein, membership card is a php generated jpg. The function is called after successful shop payment.

Thanks.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

I see. So what are you doing with generated image at the moment? And what are you trying to achieve?

a unique membership card is created and stored against each member.

Are you already adding the generated image to the member after a successful payment? And wish to use the Importer to make it available via Assets?

Or are you looking for a way to add the generated image to the member?

Looking for a way to store it against each member as a bucket resource.

The generated image is currently stored in a folder (say, img) and needs to be added as a resources, so that Admin can access and download the image if needed.

I'd went ahead with an alternative, to simply output image path (in img folder) in Admin. To download image Admin needs to copy and paste the link. That's not ideal, so looking for a way to add the image into resource bucket.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

You probably can use the Importer to add the generated image to Assets.

However, as far as I know, you can't update things with the Importer. So I doubt you can update a member field this way.

Hopefully Drew/Rachel or others can suggest a way to achieve this.

Thanks Hussein =)

I'm moving ahead with the alternative. If Drew does get to look at this amidst his busyness, that will be a bonus.