NATION

PASSWORD

API Telegram failure - can anyone help?

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
FORGE Founder
Lobbyist
 
Posts: 18
Founded: Jul 07, 2016
Inoffensive Centrist Democracy

API Telegram failure - can anyone help?

Postby FORGE Founder » Thu Feb 09, 2017 5:10 am

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 :)

User avatar
Imperium Anglorum
GA Secretariat
 
Posts: 12659
Founded: Aug 26, 2013
Left-Leaning College State

Postby Imperium Anglorum » Thu Feb 09, 2017 2:11 pm

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?

Author: 1 SC and 56+ GA resolutions
Maintainer: GA Passed Resolutions
Developer: Communiqué and InfoEurope
GenSec (24 Dec 2021 –); posts not official unless so indicated
Delegate for Europe
Elsie Mortimer Wellesley
Ideological Bulwark 285, WALL delegate
Twice-commended toxic villainous globalist kittehs

User avatar
Frisbeeteria
Senior Game Moderator
 
Posts: 27796
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Thu Feb 09, 2017 2:13 pm

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.

User avatar
FORGE Founder
Lobbyist
 
Posts: 18
Founded: Jul 07, 2016
Inoffensive Centrist Democracy

Postby FORGE Founder » Fri Feb 10, 2017 3:20 pm

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 "...
Last edited by FORGE Founder on Fri Feb 10, 2017 3:23 pm, edited 2 times in total.

User avatar
Frisbeeteria
Senior Game Moderator
 
Posts: 27796
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Fri Feb 10, 2017 3:24 pm

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.
Last edited by Frisbeeteria on Fri Feb 10, 2017 3:25 pm, edited 1 time in total.

User avatar
FORGE Founder
Lobbyist
 
Posts: 18
Founded: Jul 07, 2016
Inoffensive Centrist Democracy

Postby FORGE Founder » Sat Feb 11, 2017 8:43 am

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.
Last edited by FORGE Founder on Sat Feb 11, 2017 8:44 am, edited 1 time in total.

User avatar
FORGE Founder
Lobbyist
 
Posts: 18
Founded: Jul 07, 2016
Inoffensive Centrist Democracy

Postby FORGE Founder » Fri Feb 17, 2017 12:47 pm

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 :)
Last edited by FORGE Founder on Fri Feb 17, 2017 3:29 pm, edited 1 time in total.

User avatar
FORGE Founder
Lobbyist
 
Posts: 18
Founded: Jul 07, 2016
Inoffensive Centrist Democracy

Postby FORGE Founder » Fri Feb 17, 2017 12:56 pm

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.
Last edited by FORGE Founder on Fri Feb 17, 2017 3:30 pm, edited 3 times in total.

User avatar
FORGE Founder
Lobbyist
 
Posts: 18
Founded: Jul 07, 2016
Inoffensive Centrist Democracy

Postby FORGE Founder » Fri Feb 17, 2017 1:20 pm

I tried to do everything over again with a new telegram template, but no luck.
Last edited by FORGE Founder on Fri Feb 17, 2017 3:11 pm, edited 1 time in total.

User avatar
FORGE Founder
Lobbyist
 
Posts: 18
Founded: Jul 07, 2016
Inoffensive Centrist Democracy

Postby FORGE Founder » Mon Feb 20, 2017 3:14 pm

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.

User avatar
Frisbeeteria
Senior Game Moderator
 
Posts: 27796
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Mon Feb 20, 2017 4:15 pm

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.

User avatar
FORGE Founder
Lobbyist
 
Posts: 18
Founded: Jul 07, 2016
Inoffensive Centrist Democracy

Postby FORGE Founder » Tue Feb 21, 2017 4:01 am

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 :)
Last edited by FORGE Founder on Tue Feb 21, 2017 4:02 am, edited 2 times in total.

User avatar
The NewsStand
Attaché
 
Posts: 84
Founded: Jun 01, 2017
Ex-Nation

Postby The NewsStand » Fri Dec 29, 2017 12:44 pm

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!)


Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Blogotopia, Cha Hetstopia, Danternoust, Dark shadow lands, Dimetrodon Empire, Hiram Land, Ioudaia, Japtilas, Lignuntia, Newsorn, PCPS, Pip Plash, Xoshen

Advertisement

Remove ads