API3
gldev at August 5th, 2014 10:35 — #1
We are trying to use the API3, however even though we triple checked the credentials it is still returning 401.
We are using FREE/Trial account, is that the issue?
Do you have any ideas how to resolve this as we cannot continue with any further testing unfortunately.
Any ideas will be highly appreciated.
pete_onepagecrm at August 5th, 2014 10:57 — #2
Hi @gldev, have you tried signing in to our api browser using your credentials?
If you can't sign in to that it's likely some problem with your account.
If you can sign in to that - it's a problem with your api client.
Can you try that first and let us know how you get on?
pete_onepagecrm at August 6th, 2014 06:34 — #3
Hi @gldev, sorry, we've had some problems with the developer forum in the last day or two. I think we are back up and running now.
Did you have any luck logging into the api browser at developer.onepagecrm.com/api_browser ?
gldev at August 6th, 2014 08:52 — #4
Managed to login, result below:-
{
"user_id": "xxxxxxxxxxxxxxx",
"counts": 0
}
],
"id": "53c38f65eb89971497000014",
"text": "Inactive",
"description": "You are not actively selling to.",
"color": "666666"
}
},
{
"status": {
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
] ,
"id": "53c38f65eb89971497000015",
"text": "General",
"description": "Non-sales related contacts.",
"color": "000000"
}
},
{
"status": {
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "53db7566eb89970493000004",
"text": "Opportunity",
"description": "Good chance to become a client.",
"color": "ff00ff"
}
}
],
"sales": {
"target": 5000,
"won": 0,
"pending": 2207,
"expires": "2014-09-01"
},
"team_stream": {
"users": [
{
"user_id": "53c38f37eb89971289000003",
"counts": 4
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 3
}
],
"all": 7
},
"lead_sources": [
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "advertisement",
"text": "Advertisement"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "email_web",
"text": "Email or Web"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "list_generation",
"text": "List Generation"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "other",
"text": "Other"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "partner",
"text": "Partner"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "referral",
"text": "Referral"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "seminar",
"text": "Seminar"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "social",
"text": "Social"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "tradeshow",
"text": "Tradeshow"
},
{
"counts": 2,
"total_count": 2,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 2
}
],
"id": "53c39285eb899723b3000005",
"text": "WCF"
},
{
"counts": 0,
"total_count": 0,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 0
}
],
"id": "word_of_mouth",
"text": "Word of mouth"
},
{
"counts": 1,
"total_count": 1,
"team_counts": [
{
"user_id": "53c43628eb8997287c000004",
"counts": 0
},
{
"user_id": "53db9f21eb89976bc500000c",
"counts": 0
},
{
"user_id": "53c38f37eb89971289000003",
"counts": 1
}
],
"id": "53c3e22beb8997588d000014",
"text": "goliveuk.com website"
}
],
"contacts_count": {
"all": {
"1": 0,
"a": 1,
"b": 1,
"c": 0,
"d": 1,
"e": 1,
"f": 0,
"g": 0,
"h": 0,
"i": 0,
"j": 0,
"k": 0,
"l": 0,
"m": 1,
"n": 1,
"o": 0,
"p": 0,
"q": 0,
"r": 0,
"s": 0,
"t": 0,
"u": 0,
"v": 0,
"w": 0,
"x": 0,
"y": 0,
"z": 0,
"total_count": 6
},
"users": [
{
"1": 0,
"user_id": "53c38f37eb89971289000003",
"a": 1,
"b": 0,
"c": 0,
"d": 0,
"e": 1,
"f": 0,
"g": 0,
"h": 0,
"i": 0,
"j": 0,
"k": 0,
"l": 0,
"m": 1,
"n": 1,
"o": 0,
"p": 0,
"q": 0,
"r": 0,
"s": 0,
"t": 0,
"u": 0,
"v": 0,
"w": 0,
"x": 0,
"y": 0,
"z": 0,
"total_count": 4
},
{
"1": 0,
"user_id": "53db9f21eb89976bc500000c",
"a": 0,
"b": 1,
"c": 0,
"d": 1,
"e": 0,
"f": 0,
"g": 0,
"h": 0,
"i": 0,
"j": 0,
"k": 0,
"l": 0,
"m": 0,
"n": 0,
"o": 0,
"p": 0,
"q": 0,
"r": 0,
"s": 0,
"t": 0,
"u": 0,
"v": 0,
"w": 0,
"x": 0,
"y": 0,
"z": 0,
"total_count": 2
}
]
}
}
ruairi at August 6th, 2014 09:05 — #5
Hi @gldev was this in the api browser or with your client?
gldev at August 6th, 2014 09:34 — #6
In the browser looks fine.
In the API client still fails.
Any ideas will be appreciated. Thank you in advance.
ruairi at August 6th, 2014 09:48 — #7
I've had a 401 caused be incorrect url encoding for query parameters and by not creating the auth token correctly.
Signing samples an be found at http://developer.onepagecrm.com/#signing if you need them
gldev at August 6th, 2014 10:10 — #8
It's ALIVE!
Thank you very much everyone, case closed!
ruairi at August 7th, 2014 04:31 — #9
That's great to hear.
Would you mind telling us how you solved it so that we can better help people who have similar problems?
gldev at August 7th, 2014 05:37 — #10
Hi, sure.
We didn't used the username and password of the administrator of the account, we used UserID and Key, which we took from the link you've sent us.
ruairi at August 8th, 2014 04:37 — #11
Thanks for explaining your problem.
I'll see if we can make it clearer that you need to use your own user id and auth key in the documentation.
apps_n_analysis at August 24th, 2014 18:20 — #12
Hello There.
I am getting the same 401 unauthorized error But i dont know how to resolve it. I am more than 100% sure that my iOS Mobile API client is 100% correct.
What does gldev mean at the end?
"We didn't used the username and password of the administrator of the account, we used UserID and Key, which we took from the link you've sent us."
What does he mean by administrative account? I am using my own user ID and Auth key returned from my login response and I am using this email for login. alex.feltwell@aanda.im
Please help me. How can this issue be resolved?
ruairi at August 25th, 2014 06:04 — #13
That just means that @gldev used the default user id and key that are in the documentation.
Usually the 401 error is due to incorrect login details or an incorrect signature.
As you have managed to get your user id and key then the problem is most likely with your signature.
To check if your signature is working try sending the sample options that are used in the documentation at
http://developer.onepagecrm.com/#signingAnd see that you get the same result.
If that gives the same result then the problem could be that you may not have base64 decoded your API key or you might not be sending the same data used to generate the key to our servers.
apps_n_analysis at August 26th, 2014 15:05 — #14
Well, that is really really frustrating for me. It took my 3 full days to work on your API but again getting that Invalid_Auth_token 401 error. I am exactly following the process mentioned in Your API documentation. I am getting a valid signature and API key is also getting base 64 decoded as it is written in your sample code. Let me share you my iOS code. Please download the attached code from here.
https://dl.dropboxusercontent.com/u/101850582/CRMCode.rtf
From NSLog statements, I get the signature message as:
Signature Message: 53da9abdeb89975c4500001e.1409077523.POST.e2485581920cdfa47003042d3bcbc753af135977.96197dfb1a4c332755a489c394397f2c1007aaf9
and Auth signature as:
Auth Signature: 21822bed18bead7f2ec84eb3462fe76418c3590879e5dd436f89f20ad899556c
Now Please tell me where I am going wrong?
Thanks
apps_n_analysis at August 26th, 2014 15:09 — #15
Well I have Posted a hard coded JSON String in my code. You can verify my JSON from here as well.
http://json.parser.online.fr/
ruairi at August 27th, 2014 04:42 — #16
The headers are case sensitive so change lines 20-23 with the following.
[request addValue:U_ID forHTTPHeaderField:@"X-OnePageCRM-UID"];
[request addValue:timestamp forHTTPHeaderField:@"X-OnePageCRM-TS"];
[request addValue:authSignature forHTTPHeaderField:@"X-OnePageCRM-Auth"];
I'll add a warning to the doumentation about this.
apps_n_analysis at August 27th, 2014 08:46 — #17
I have changed the Headers as per your suggestion:
[request addValue:U_ID forHTTPHeaderField:@"X-OnePageCRM-UID"];
[request addValue:timestamp forHTTPHeaderField:@"X-OnePageCRM-TS"];
[request addValue:authSignature forHTTPHeaderField:@"X-OnePageCRM-Auth"];
Still getting Invalid-auth-token 401 error message. Kindly resolve this issue. You try my code. I have provided you everything and see why is it not working. I am having a delay in my project because of this.
ruairi at August 27th, 2014 09:58 — #18
Unfortunately none of our developers have a dev environment capable of running your code and none of us are Objective-C developers so the best we can do is to give advice.
As I don't know Objective-C very well I could be wrong but should there be a:
[request setHTTPBody:requestBodyString];
for the request too?
apps_n_analysis at August 27th, 2014 17:10 — #19
Yes, Thanks.
Resolved this but got into another one. I am getting some data invalidation error.
I set
[request setHTTPBody:[requestBodyString dataUsingEncoding:NSUTF8StringEncoding]];
and posting the following JSON.
{"first_name":"Shahid","custom_fields":[{"custom_field":{"id":"message"},"value":"Testing message for CRM."},{"custom_field":{"id":"services"},"value":"Template Apps, Outsourced Development"},{"custom_field":{"id":"twitter"},"value":"shahid_iqbal452"}],"company_name":"Apps & Analysis","last_name":"Iqbal","emails":[{"type":"work","value":"shahidiqbal452@yahoo.com"}],"urls":[{"type":"website","value":"www.google.com"}],"phones":[{"type":"work","value":"0300123123"}]}
and I am getting the following error message.
{"status":400,"message":"Invalid request data","error_name":"invalid_request_data","error_message":"A validation error has occurred","errors":{"lastname":"Either last name or company name are required to create a Contact.","company":"Either last name or company name are required to create a Contact."}}
Please help me. What is wrong now. I am posting last_name and company But still getting this error.
ruairi at August 28th, 2014 04:31 — #20
Your custom field ids are incorrect but other than that when I send the same request (replacing the ids for ones that exist in my account) it works fine.
To get the custom field ids make aGET https://app.onepagecrm.com/api/v3/custom_fields.json
request.
The error reponse is incorrect and should say last_name
instead of lastname
and company_name
instead of company
.
It looks like the error is still in your code so I can only confirm that the problem isn't on our end.
next page →
Powered by Discourse, best viewed with JavaScript enabled