Page 1 of 1

API Telegram failure - can anyone help?

PostPosted: Thu Feb 09, 2017 5:10 am
by FORGE Founder
When I attempted to send a recruitment telegram using the API, I encountered the following error:
"Error: 403 Region mismatch between Telegram and Client API Key"

The recruitment telegram was written by this nation. I used the client key I requested recently,
which was for this nation. This nation resides in the region it recruits for, and has permission
to recruit for it.

I'm left clueless what might be causing the error. Any help would be greatly appreciated :)

PostPosted: Thu Feb 09, 2017 2:11 pm
by Imperium Anglorum
FORGE Founder wrote:The recruitment telegram was written by this nation. I used the client key I requested recently,
which was for this nation. This nation resides in the region it recruits for, and has permission
to recruit for it.

Is the telegram a telegram for a region which is not the region for which the API key was issued?

PostPosted: Thu Feb 09, 2017 2:13 pm
by Frisbeeteria
Split from API thread.

At the bottom of your telegram template is a link for "Delivery Reports". That also contains your TGID and your Secret Key. Are you sure you're using the right versions of both of those? I checked, and you've got two different templates, with different TGIDs and Secret Keys. Make sure you're using the right ones.

Imperium Anglorum wrote:Is the telegram a telegram for a region which is not the region for which the API key was issued?

Nope. He's resident in the correct region.

PostPosted: Fri Feb 10, 2017 3:20 pm
by FORGE Founder
Imperium Anglorum wrote:
FORGE Founder wrote:The recruitment telegram was written by this nation. I used the client key I requested recently,
which was for this nation. This nation resides in the region it recruits for, and has permission
to recruit for it.

Is the telegram a telegram for a region which is not the region for which the API key was issued?

Frisbeeteria wrote:Split from API thread.

At the bottom of your telegram template is a link for "Delivery Reports". That also contains your TGID and your Secret Key. Are you sure you're using the right versions of both of those? I checked, and you've got two different templates, with different TGIDs and Secret Keys. Make sure you're using the right ones.

Imperium Anglorum wrote:Is the telegram a telegram for a region which is not the region for which the API key was issued?

Nope. He's resident in the correct region.


Thanks to both of you for the reply :)
I've double checked just now by using the tgid and key from the last telegram. Sadly, it returns the same error.

Could it be possible I received a bad client key? It's weird though, as the key does exist, otherwise it should return "Error: 403 Client Not Registered For API "...

PostPosted: Fri Feb 10, 2017 3:24 pm
by Frisbeeteria
FORGE Founder wrote:Could it be possible I received a bad client key?

Not really, no. If you really can't find the issue, you could ask for a new key via GHR. I'd prefer you exhaust other options first.

Did you remove any leading or trailing spaces? That would cause a failure.

PostPosted: Sat Feb 11, 2017 8:43 am
by FORGE Founder
Frisbeeteria wrote:
FORGE Founder wrote:Could it be possible I received a bad client key?

Not really, no. If you really can't find the issue, you could ask for a new key via GHR. I'd prefer you exhaust other options first.

Did you remove any leading or trailing spaces? That would cause a failure.

I tried again and verified that there were no spaces, but it returns the same error.

PostPosted: Fri Feb 17, 2017 12:47 pm
by FORGE Founder
As I saw no other options, I lodged a new request for a client key.

The same problem (Error: 403 Region mismatch between Telegram and Client API Key) persists though, regardless of using a script or not. Manually using the link as documented in the API [https://www.nationstates.net/cgi-bin/api.cgi?a=sendTG&client=(Client Key)&tgid=(TGID)&key=(Secret Key)&to=(nation_name)] is what allowed me to narrow it down to the given error, hence I fear the problem doesn't lie with the scripts I'd otherwise use for recruitment.

Image


I also noticed this in the TG which contained the new client key:
Client Name: @FORGE [nation=short]FORGE Founder[/nation]
Region: FORGE

Is that "@FORGE" supposed to be in front of the nation name, or not? I think it was like that too when I received the previous key, but I'm not sure
as I deleted that telegram (looking back, I probably shouldn't have).

Anyway, I hope someone can help me solve this so I don't have to waste any more of your time :)

PostPosted: Fri Feb 17, 2017 12:56 pm
by FORGE Founder
As suggested by a mod who argued that NS doesn't like to have multiple accounts open at the same time, I tried to use the link in the above post again in a new browser session. I tried deleting all cookies as well as emptying my cache and then tried again, but still no luck.

I usually use Nightly to browse the internet. The above was tested both in Nightly and the common Mozilla Firefox.
Chrome and Edge were tested as well.

PostPosted: Fri Feb 17, 2017 1:20 pm
by FORGE Founder
I tried to do everything over again with a new telegram template, but no luck.

PostPosted: Mon Feb 20, 2017 3:14 pm
by FORGE Founder
I solved it, at last. The fault was on my part. When setting up the API template, I used "This is a [recruitment] telegram for [an organisation]", while
the client key was requested for a region. Boundaries between the two are vague when an organisation is tied to a region, and that's probably what
confused me.

My sincerest apologies if this issue wasted your time, and thanks to those who tried to help.

PostPosted: Mon Feb 20, 2017 4:15 pm
by Frisbeeteria
FORGE Founder wrote:"This is a [recruitment] telegram for [an organisation]", while the client key was requested for a region.

There's no difference between the keys. Selecting "recruitment" adds the "Move to [myregion] button at the bottom. Selecting "organisation" leaves off the button. Selecting "Campaign" just changes the blocking filter. Same key works the same on all of them.

PostPosted: Tue Feb 21, 2017 4:01 am
by FORGE Founder
Frisbeeteria wrote:
FORGE Founder wrote:"This is a [recruitment] telegram for [an organisation]", while the client key was requested for a region.

There's no difference between the keys. Selecting "recruitment" adds the "Move to [myregion] button at the bottom. Selecting "organisation" leaves off the button. Selecting "Campaign" just changes the blocking filter. Same key works the same on all of them.


So this means there's an issue with recruiting for "an organisation", as that returns a region mismatch error. Which is odd, as it's
not for a region at all.

If anyone wants to delve into this issue, I'll be glad to help. For now, I'm fine with using a region :)

PostPosted: Fri Dec 29, 2017 12:44 pm
by The NewsStand
FORGE Founder wrote:
Frisbeeteria wrote:There's no difference between the keys. Selecting "recruitment" adds the "Move to [myregion] button at the bottom. Selecting "organisation" leaves off the button. Selecting "Campaign" just changes the blocking filter. Same key works the same on all of them.


So this means there's an issue with recruiting for "an organisation", as that returns a region mismatch error. Which is odd, as it's
not for a region at all.

If anyone wants to delve into this issue, I'll be glad to help. For now, I'm fine with using a region :)

Hi,

I had a similar 403 error:
"Attempt to use Region API Key for Non-Regional Recruitment
Error: 403 Attempt to use Region API Key for Non-Regional Recruitment

The NationStates API Documentation"

Like you, my TG was set to recruit for an organisation.

I've set up a new TG, which is set to recruit for the region as a workaround.

(btw, thanks to the Mods for sorting out the Keys, and pointing me in the right direction!)