How to use Secretary of State API with long polling

Code – https://github.com/cobalt-intelligence/sos-long-polling-example

This has examples of how to use the Secretary of State API, including examples of how to use the long polling.

Get API key here – https://cobaltintelligence.com/secretary-of-state

Transcript:

Okay. Now we have some examples. Good morning, Jordan cobalt intelligence talking about the secretary of state API. Here we go. We’re over here. Um, like I said, cobalt intelligence. You can find it here. Coldwell intelligence.com/whatever it’ll be in the comments and you can go through here. And the goal of this is just to kind of give some examples of how this works.

Um, And for example, here, you can call it over here, but you’ll need an API key for, to make it work. This is just documentation of how to do it. So if you’re using code, this is the JavaScript TypeScript stuff we’re going to go through. I have two different functions here, and this is going to go over normal state search right here, which is this right here with no long polling and then long pulling example.

So let’s do that right here. Call with state search and I’ll have the get hub in the comments as well. This will be public code. You start it and it’ll just call the Idaho.

It’s calling to Idaho. There we go. I know bam easy. Now, if we want to do a search with lawn polling like Delaware right here, this is going to call over here. See, we had this. All it does is called the URL. We have an API key. You’ll have to get an API key from me. You just send a request over here from this webpage at the bottom, you can get a beta API key, um, and that’s free.

Um, you’ll have a limited amount you can use per month, but you know, we can talk about how much you need and we can adjust for that. So this is the Delaware example. It’s going to go over here. Now it’s going to start the long pole, then it gives us a retry ID. And that’s the idea right here. We’ll copy.

And you’ll just use that in the same call. Just update your query parameters. So you see this, the same URL right there, but instead of all this search query and state that you pass to it, you’re going to just pass the retry ID. All right. So now we’re going to fast forward to the future. I’m going to skip the next minute.

Here we go. And I’ll be back. Okay, now we’re back. Now. We should be good. Here. We have our ID. So I did a little request. It said item not complete. And I think it is complete now. So we’re going to go like this and bam. There it is. That’s it. We just, we try with the retry ID once it’s complete and we’ll get it.

That’s all. That’s it. That’s the core API C long polling example here. If you need an API key, come over here to this URL, I’ll put it in the comments and, uh, that’s it. Two functions here to show how to do it. I think that’s all.

Hey there. Want to be friends?

I'll be straight with you. I'm going to want to show off my web scraping genius. But I want to hear about your web scraping troubles and successes as well.

And I like you. So I won't be one of those weird friends who is always calling. What do you say?