I have an issue with this get request of bugzilla to get the page of bug_list of two bugs "http://10.0.6.199:8080/bugzilla/rest.cgi/bug?id=2313,3478?api_key=my_api_key"
The issue appeared when I write more than one bug id to get the page of bug_list, I get this response
{
"code" : 410,
"documentation" : "http://www.bugzilla.org/docs/tip/en/html/api/",
"error" : true,
"message" : "You must log in before using this part of Bugzilla."
}
but I have no issus when I write one id by this get request
http://10.0.6.199:8080/bugzilla/rest.cgi/bug/2313?api_key=my_api_key
Can any one tell me the problem with this get request link?
I got the problem, I should write '&' before api_key instead of '?'
http://10.0.6.199:8080/bugzilla/rest.cgi/bug?id=2313,3478&api_key=my_api_key
instead of
http://10.0.6.199:8080/bugzilla/rest.cgi/bug?id=2313,3478?api_key=my_api_key"
Related
I'm having trouble with passing in parameters to a get request. This request is intended to return a list of warehouses after the user entered some search parameters such as Date, State, ZIP and/or warehouse number, which is the only mandatory field. So when the search button is pressed the query is executed, but im getting this error:
2021-04-19 15:49:00 +0000
2021-11-02 13:06:44.670511-0600 WAREHOUSE_IOS-Master[3142:186324] GET method must not have a body
2021-11-02 13:06:44.670799-0600 WAREHOUSE_iOS-Master[3142:186324] Task <C7839029-C527-490E-8747-137012285F14>.<3> finished with error [-1103] Error Domain=NSURLErrorDomain Code=-1103 "resource exceeds maximum size" UserInfo={NSLocalizedDescription=resource exceeds maximum size,
error: invalidResponse
Okay so what im doing is passing a body to the get request that includes the search parameters as such:
struct WarehouseBody : Codable {
let dateRegistration : String?
let state : String?
let zip : String?
let warehouseNumber : String
}
and I'm expecting a response of this type:
struct WareHouseResponse: Codable {
let status: String?
let code: Int?
let responseCode, message: String?
let error: Bool?
let errorMessage: String?
let result: Result?
enum CodingKeys: String, CodingKey {
case status = "Status"
case code = "Code"
case responseCode = "ResponseCode"
case message = "Message"
case error = "Error"
case errorMessage = "ErrorMessage"
case result = "Result"
}
}
but according to what I've reading on other posts this is not the correct way of using a get request, but I really really need to do some testing. Is there a way that I can achieve this without needing to alter the backend? Just to mention that I ´m also the developer of the backend (c# using .net framework and dapper)so if the easiest way is to achieve this is by altering it I can also do that. Any ideas are very much appreciated.
On the backend I was thinking of implementing a post Request that sends the search parameters to the server and then a get request that pulls out the requested information, but I don't know if that's the correct approach. But this not feasible at the moment because the Web API are already publish and I cannot re publish with the changes at the moment, and is really urgent to test the response so that's why I would like to know if all this can be done from the front end first. Thank you very much for all the help!
Thank you very much for your help!
EDIT: Also I forgot to mention that the api has been previously tested on POSTMAN and is working perfectly.
Since iOS 13. you cannot pass in parameters to a GET request. There’s no easy way around this. You need to change your request from a GET to a POST on the backend. In my case, this was an easy task because I had access to the API source— but, if you don’t, just ask the backend team to change it, and pass in the parameters as in any other POST request. That should work.
As I am on my way to switch from using the legacy header authentication method to the JWT Token method, I have used the following example found here.
However, I get the following error :
Error calling Login: {
"errorCode": "PARTNER_AUTHENTICATION_FAILED",
"message": "The specified Integrator Key was not found or is disabled. An Integrator key was not specified."
}
Below is my C# code.
string oauthBasePath = "account-d.docusign.com";
string privateKeyFilename = "./private.pem";
int expiresInHours = 1;
ApiClient apiClient = new ApiClient(docuSignUrl);
apiClient.ConfigureJwtAuthorizationFlow(
"IntegratorKey",
"USER ID GUID",
oauthBasePath,
privateKeyFilename,
expiresInHours);
AuthenticationApi authApi = new AuthenticationApi(apiClient.Configuration);
return authApi.Login();
I have found this thread that shows the similar error but it doesn't seem resolved
Update 05/07/2018: I have validated the domain used in my account but I still get the same error message
Update 05/11/2018: When I use my code but that I replace the IntegratorKey, UserID and private key used in the DocuSign Unit Tests here, my code now works !? Hence, I can only conclude that the issue doesn't come from my code but maybe a configuration issue on the DocuSign side ? do I need to configure my Integrator Key a specific way ?
After more investigation, the reason with such an error is that I was not generating the Authorization Code Grant prior to executing my code.
Based on the information found here, I had to perform the following HTTPRequest example :
GET /oauth/auth?
response_type=token
&scope=signature
&client_id=YOUR_INTERGRATOR_KEY
&state=a39fh23hnf23
&redirect_uri=http://www.example.com/callback
Once it is approved, then I can run my code successfully.
In the end, the initial error message is really misleading (I might argue it could be considered a bug ?).
I have the following error when using DropNet library to make connection to DropBox.
Trying to implement it for my CMS and also for my knowledge :)
trying the current documentation of DropNet.
Source:https://github.com/DropNet/DropNet
Current code:
var _client = new DropNetClient(Core.DropBoxAPI, Core.DropBoxKeySecret);
UserLogin login = _client.GetToken();
_client.UserLogin = login;
String Url = _client.BuildAuthorizeUrl();
Produces:
Received Response [Unauthorized] : Expected to see [OK]. The HTTP
response was [{"error": "Unauthorized"}].
Exception: DropNet.Exceptions.DropboxRestException: Received Response
[Unauthorized] : Expected to see [OK]. The HTTP response was
[{"error": "Unauthorized"}].
I want to let the user connect to the Url returned by _client.BuildAuthorizeUrl(); but it even won't let me get to url
and i also have a Key and Secret generated from DropBox.com
if i try to set the method _client.BuildAuthorizeUrl(); as first statement it gives also an error on the DropBox page itselfs.
I tried to find an another post on Stackoverflow but i didn't find any solution so fare.
Its still using the basics of the documentation and it goes wrong.
If you have any ideas that would be nice.
Thanks for the advices.
I was filling the secret the same as the APP key.
I am trying to use google geocoding. If i just type
https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true
it gives me right output. I am trying to use this with a amazon proxy server and it gives
{ "error_message" : "The 'sensor' parameter specified in the request must be set to either 'true' or 'false'.", "results" : [], "status" : "REQUEST_DENIED" }
This the code
http://ec2-00-000-000-000.compute-1.amazonaws.com/OsProxy/getpage.aspx?p=https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true
Can someone help me?
Thanks
Rashmi
You need to URL-encode your parameters. Consider the URL you're using:
http://ec2-00-000-000-000.compute-1.amazonaws.com/OsProxy/getpage.aspx?p=https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true
This is parsed as:
http://ec2-00-000-000-000.compute-1.amazonaws.com/OsProxy/getpage.aspx?
p=https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&
sensor=true
That is, you're passing the sensor parameter to amazonws.com, not to googleapis.com.
Since the only parameter to amazonws.com should be the full URL, encode that URL so it reaches amazonws.com as a single parameter to be passed through to googleapis.com:
http://ec2-00-000-000-000.compute-1.amazonaws.com/OsProxy/getpage.aspx?p=https%3A%2F%2Fmaps.googleapis.com%2Fmaps%2Fapi%2Fgeocode%2Fjson%3Faddress%3D1600%2BAmphitheatre%2BParkway%2C%2BMountain%2BView%2C%2BCA%26sensor%3Dtrue
I'm using the basic Response.StatusCode to set the status code to 9999. This page is being called via an AJAX call, checking the status code on readyState = 4 and popping an alert on 9999 using the message set by Response.StatusDescription. All I'm getting is readyState = 4 and statusCode = 200. I can provide code if needed, but it's not trim, so I'll trim it down if the code is needed/requested. Any help is appreciated.Coded in C# ASP.NET and Javascript.
UPDATE Purpose: I'm suing the status code 9999 to denote a "User already exists" error when adding a user to an SQL table. This is the only way I can find to let the AJAX call know when this error occurs.
You can't make up status codes. Here are the valid ones
I think the best option is to send back your status and message in a json response.
{
status: 9999,
message: "User already exists"
}
Here is a SO post with some links that might educate you on how to do this:
Returning JSON object from an ASP.NET page