How to get users registered in form through API?

Is there any way to pull the users that have registered in a form from a divhunt api?

@Serpa

Do you mean form submissions?

Yes, from the form submissions I can access through the backoffice.

You’re in luck :slight_smile: We are releasing API today :slight_smile: Well, first part of it, but it will include forms!

I’ll let you know when it’s live!

nice! let me know plz.

@Serpa

You are first one who will use Divhunt API officially :slight_smile: Congratz, this is is huge!!!

  1. Go to Divhunt Dashboard
  2. Navigate to your project settings, then find the tab API Tokens
  3. Create token, name it like “Form Submissions”
  4. Go to token settings, and allow the GET endpoint forms.submission

Making the request:

  • Until we release documentation, which will be in next few days (it’s auto generated), you need to learn how to get full URL for each endpoint.

So it’s domain + “/api” + add-on + endpoint

In this case GET https://your-domain.divhunt.art/api/admin/forms.submission

And along with request, you need to pass header Authorization with the token, which is provided, you can click on it to copy it.

Note: This request will ask you to provide ID, either as query param ?id= or as body JSON, the ID of form you can find in your admin panel, in form settings you can copy ID of form you need to get submissions.

Let me know if you had any success with this :slight_smile:

3 Likes

Hey @dejan!

Thanks for the detailed examples!

So, I’ve followed what you said, and I’m getting this error now.

$ curl -H "Authorization: Bearer xxxxxxx-7" "https://XXX.divhunt.art/api/admin/forms.submission?id=459"

{"success":false,"message":"Invalid action.","framework":{"mode":"app","time.connection":2.4,"time.database":8.3,"time.query":5.9,"time":"12.0"}}

I’ve added the permissions and such:

Not sure if I’m missing anything.

@Serpa

Authorization without “Bearer” just the token.

@dejan

Thanks, I removed the Bearer and also added an s to the end of submission :slight_smile:

End result:

curl -H "Authorization: XXX-7" "https://xxx.divhunt.art/api/admin/forms.submissions?id=459"

@Serpa

Perfect :slight_smile: we will release documentation soon and add more endpoints (CMS).

@dejan

Thanks, just one more thing.

Will the submissions endpoint have a pagination or something like that when there is a great amount of data?

Also, can I delete the submissions through the API?

Thanks!

@Serpa

You use now both ?limit=100 and ?page=1 with GET submissions endpoint.

@Serpa

I’ve added an endpoint for removing form submissions.

DELETE https://your-domain.com/api/admin/forms.submission?id=ID-of-a-submission

Also I want to check with you if is fine to update first endpoint

FROM
GET https://your-domain.com/api/admin/forms.submissions?id=ID-of-a-form
TO
GET https://your-domain.com/api/admin/forms.submissions?form=ID-of-a-form

So essentially, we just change ?id to ?form, so it does not get confusing for people so they understand that they need to provide form ID and not submission ID.

Since you are the only one who uses this endpoint, let me know if we can make a change?

Hey @dejan !

Thanks for the info and for the check.

Yes, go ahead! I’ll change that in my app as well.

@Serpa

Updated! Please update on your side. Thanks.

Let me know if you need any endpoint and I will deliver one by one, you can request literally anything :smiley: at the end, API will cover 100% of your website data and actions.

2 Likes