Comments (6)
@Gargo, Thanks for reaching out. Could you please print the curl for the command by using the following code -
let service = FDGetPlayerSummariesService(steamids: ["76561198015933145"])
print(service.request.debugDescription)
from restofire.
I could see the following response from the server after running the curl of the service you gave me.
curl -v \
> -H "User-Agent: Restofire/1.0 (com.apple.dt.playground.stub.iOS_Simulator.Restofire-1A30C476-4FA9-48B7-B61B-451B5DCF5FC2; build:1; iOS 13.3.0) Alamofire/4.9.1" \
> -H "Accept-Language: en;q=1.0" \
> -H "Content-Type: application/json" \
> -H "Accept-Encoding: gzip;q=1.0, compress;q=0.5" \
> -d "{}" \
> "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?steamids=76561198015933145&key=BBD52AB62CD9B4E067C060466F0E9AC9"
* Trying 104.103.200.178...
* TCP_NODELAY set
* Connected to api.steampowered.com (104.103.200.178) port 80 (#0)
> POST /ISteamUser/GetPlayerSummaries/v0002/?steamids=76561198015933145&key=BBD52AB62CD9B4E067C060466F0E9AC9 HTTP/1.1
> Host: api.steampowered.com
> Accept: */*
> User-Agent: Restofire/1.0 (com.apple.dt.playground.stub.iOS_Simulator.Restofire-1A30C476-4FA9-48B7-B61B-451B5DCF5FC2; build:1; iOS 13.3.0) Alamofire/4.9.1
> Accept-Language: en;q=1.0
> Content-Type: application/json
> Accept-Encoding: gzip;q=1.0, compress;q=0.5
> Content-Length: 2
>
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 405 Method Not Allowed
< Allow: GET
< Content-Length: 146
< Content-Type: text/html; charset=UTF-8
< Expires: Tue, 07 Jan 2020 23:13:09 GMT
< Cache-Control: max-age=0, no-cache, no-store
< Pragma: no-cache
< Date: Tue, 07 Jan 2020 23:13:09 GMT
< Connection: close
<
* Closing connection 0
<html><head><title>Method Not Allowed</title></head><body><h1>Method Not Allowed</h1>This API must be called with a HTTP GET request</body></html>%
Since it is a get request and you are adding parameters, You might want to change to queryParameters
. Try replacing your service code with the following code
struct FDGetPlayerSummariesService: Requestable {
typealias Response = FSUserInfoModel
var path: String? = "ISteamUser/GetPlayerSummaries/v0002/?steamids=76561198015933145&key=BBD52AB62CD9B4E067C060466F0E9AC9"
var queryParameters: [String: Any]?
init(steamids: [String]) {
// let steamidsString = steamids.joined(separator: ",")
// queryParameters = ["steamids": steamidsString, "key": apiKey]
queryParameters = [:]
}
func request(_ request: RequestOperation<FDGetPlayerSummariesService>, didCompleteWithValue value: [FSUserInfoModel]) {
print()
}
func request(_ request: RequestOperation<Self>, didFailWithError error: Error) {
print()
}
}
from restofire.
@RahulKatariya thanks now it works at least with a hardcoded path. But you should mention the whole _Configurable
protocol in readme.
from restofire.
@gerchicov-bp. I admit more documentation or examples are indeed required to understand fully. I couldn't help but notice your comment, there is a dictionary extension that takes care of adding nil with a dictionary. Are you still not able to use it with parameters?
from restofire.
@gerchicov-bp everything seems to be ok now. Previously I didn't see that parameters
and queryParameters
have different types.
from restofire.
I am glad it all worked out for you. Closing the issue then!
from restofire.
Related Issues (20)
- Command failed due to signal: Segmantation fault: 11 HOT 3
- Example Usage with ObjectMapper
- Failed to serialize Requestable Model HOT 3
- Downloading image or file? HOT 2
- Doesn't work with SPM HOT 1
- XCODE 9 UrlError.Code error HOT 1
- Alamofire 4? HOT 1
- Feature: Fake Responses HOT 6
- Feature: Request Delegates HOT 3
- Feature: Streamable Protocols
- Feature: Add Keypath to Configurable HOT 1
- Chore: Usage Example with FlowCoordinators
- Chore: Usage example of Custom Response Serializer
- Feature: Support internet connectivity with Alamofire Protocols HOT 2
- Feature: Encodable Parameters
- Feature: Update to Swift 4.1 and Xcode 9.3
- Broken example HOT 2
- Swift Package Manager installation does not work HOT 3
- Error in readme HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restofire.